Callable Cloud Functions? How callable Firebase Cloud Functions work

This lesson is available for PRO members or as a single course purchase. Sign-in and choose a plan below.


*Enrollment provides full access to this course (and updates) for life.

Or Signup for Unlimited PRO Access

Git Branch 3

file_type_typescript index.ts
import * as functions from 'firebase-functions';

export const testFunction = functions.https.onCall( async (data, context) => {
    const uid  = context.auth && context.auth.uid;
    const message = data.message;

    return `${uid} sent a message of ${message}`
});

Callable functions make it possible to call HTTP cloud functions with the user’s Firebase auth context. This can dramatically simplify our code because it means we no longer need to manually validate auth headers in our cloud functions.

command line
firebase init hosting 

firebase deploy --only functions

firebase serve

Q&A Chat