firebase-admin.functions package

Firebase Functions service.

Functions

Function Description
getFunctions(app) Gets the Functions service for the default app or a given app.getFunctions() can be called with no arguments to access the default app's Functions service or as getFunctions(app) to access the Functions service associated with a specific app.

Classes

Class Description
FirebaseFunctionsError Cloud Functions error code structure. This extends FirebaseError.
Functions The Firebase Functions service interface.
TaskQueue The TaskQueue interface.

Interfaces

Interface Description
AbsoluteDelivery Interface representing task options with absolute delivery.
DelayDelivery Interface representing task options with delayed delivery.
TaskOptionsExperimental Type representing experimental (beta) task options.

Variables

Variable Description
FunctionsErrorCode The constant mapping for valid Cloud Functions client error codes.

Type Aliases

Type Alias Description
DeliverySchedule Type representing delivery schedule options. DeliverySchedule is a union type of DelayDelivery and AbsoluteDelivery types.
FunctionsErrorCode The type definition for valid Cloud Functions client error codes.
TaskOptions Type representing task options.

getFunctions(app)

Gets the Functions service for the default app or a given app.

getFunctions() can be called with no arguments to access the default app's Functions service or as getFunctions(app) to access the Functions service associated with a specific app.

Signature:

export declare function getFunctions(app?: App): Functions;

Parameters

Parameter Type Description
app App Optional app for which to return the Functions service. If not provided, the default Functions service is returned.

Returns:

Functions

The default Functions service if no app is provided, or the Functions service associated with the provided app.

Example 1

// Get the `Functions` service for the default app
const defaultFunctions = getFunctions();

Example 2

// Get the `Functions` service for a given app
const otherFunctions = getFunctions(otherApp);

FunctionsErrorCode

The constant mapping for valid Cloud Functions client error codes.

Signature:

FunctionsErrorCode: {
    readonly ABORTED: "aborted";
    readonly INVALID_ARGUMENT: "invalid-argument";
    readonly INVALID_CREDENTIAL: "invalid-credential";
    readonly INTERNAL_ERROR: "internal-error";
    readonly FAILED_PRECONDITION: "failed-precondition";
    readonly PERMISSION_DENIED: "permission-denied";
    readonly UNAUTHENTICATED: "unauthenticated";
    readonly NOT_FOUND: "not-found";
    readonly UNKNOWN_ERROR: "unknown-error";
    readonly TASK_ALREADY_EXISTS: "task-already-exists";
}

DeliverySchedule

Type representing delivery schedule options. DeliverySchedule is a union type of DelayDelivery and AbsoluteDelivery types.

Signature:

export type DeliverySchedule = DelayDelivery | AbsoluteDelivery;

FunctionsErrorCode

The type definition for valid Cloud Functions client error codes.

Signature:

export type FunctionsErrorCode = typeof FunctionsErrorCode[keyof typeof FunctionsErrorCode];

TaskOptions

Type representing task options.

Signature:

export type TaskOptions = DeliverySchedule & TaskOptionsExperimental & {
    dispatchDeadlineSeconds?: number;
    id?: string;
    headers?: Record<string, string>;
};