Class

Methods

CallableContext

static

CallableContext()

A CallableContext is passed to the handler for an HTTPS Callable Function created with the onCall method.

Properties

Parameter

auth.uid

string

The uid from decoding and verifying a Firebase Auth ID token.

Value may be null.

auth.token

firebase.auth.DecodedIdToken

The result of decoding and verifying a Firebase Auth ID token.

Value may be null.

instanceIdToken

string

An unverified token for a Firebase Instance ID.

rawRequest

Object

The raw request handled by the callable. Populates all fields in the Express Request and Response objects.

Value must not be null.

onCall

static

onCall(handler) returns functions.HttpsFunction

Event handler which is run every time an HTTPS Callable function is called from a Firebase client SDK.

The event handler is called with the data sent from the client, and with a CallableContext containing metadata about the request.

Parameter

handler

function(any type, non-null functions.https.CallableContext)

Event handler which is run every time an HTTPS Callable function URL is hit. The function is called with data passed from the client. The value returned from this handler, either as a Promise or returned directly, is sent back to the client. If this handler throws (or returns a rejected Promise with) an instance of HttpsError, then the error details are sent back to the client. If this handler throws any other kind of error, then the client receives an error of type INTERNAL.

Value must not be null.

Returns

non-null functions.HttpsFunction A Cloud Function which you can export.

onRequest

static

onRequest(handler) returns functions.HttpsFunction

Event handler which is run every time an HTTPS URL is hit.

The event handler is called with Express Request and Response objects as its only arguments.

Parameter

handler

function(non-null express.Request, non-null express.Response)

Event handler which is run every time an HTTPS URL is hit. The function is called with Express objects which represent the request and the response.

Value must not be null.

Returns

non-null functions.HttpsFunction A Cloud Function which you can export and deploy.