RuntimeOptions interface

Configuration options for a function that applicable at runtime.

Signature:

exportinterfaceRuntimeOptions

Properties

PropertyTypeDescription
consumeAppCheckTokenbooleanDetermines whether Firebase App Check token is consumed on request. Defaults to false.
enforceAppCheckbooleanDetermines whether Firebase AppCheck is enforced.
failurePolicyFailurePolicy | booleanFailure policy of the function, with booleantrue being equivalent to providing an empty retry object.
ingressSettings(typeofINGRESS_SETTINGS_OPTIONS)[number] | ResetValueIngress settings which control where this function can be called from.
invoker"public" | "private" | string | string[]Invoker to set access control on https functions.
labelsRecord<string, string>User labels to set on the function.
maxInstancesnumber |Expression<number> | ResetValueMax number of actual instances allowed to be running in parallel.
memory(typeofVALID_MEMORY_OPTIONS)[number] |Expression<number> | ResetValueAmount of memory to allocate to the function.
minInstancesnumber |Expression<number> | ResetValueMin number of actual instances to be running at a given time.
preserveExternalChangesbooleanControls whether function configuration modified outside of function source is preserved. Defaults to false.
secrets(string | SecretParam)[]
serviceAccount"default" | string |Expression<string> | ResetValueSpecific service account for the function to run as.
timeoutSecondsnumber |Expression<number> | ResetValueTimeout for the function in seconds, possible values are 0 to 540.
vpcConnectorstring |Expression<string> | ResetValueConnect cloud function to specified VPC connector.
vpcConnectorEgressSettings(typeofVPC_EGRESS_SETTINGS_OPTIONS)[number] | ResetValueEgress settings for VPC connector.

RuntimeOptions.consumeAppCheckToken

Determines whether Firebase App Check token is consumed on request. Defaults to false.

Set this to true to enable the App Check replay protection feature by consuming the App Check token on callable request. Tokens that are found to be already consumed will have therequest.app.alreadyConsumed property set to true.

Tokens are only considered to be consumed if it is sent to the App Check service by setting this option to true. Other uses of the token do not consume it.

This replay protection feature requires an additional network call to the App Check backend and forces the clients to obtain a fresh attestation from the chosen attestation providers. This can therefore negatively impact performance and can potentially deplete your attestation providers' quotas faster. Use this feature only for protecting low volume, security critical, or expensive operations.

This option does not affect theenforceAppCheck option. Setting the latter to true will cause the callable function to automatically respond with a 401 Unauthorized status code when the request includes an invalid App Check token. When the request includes valid but consumed App Check tokens, requests will not be automatically rejected. Instead, therequest.app.alreadyConsumed property will be set to true and pass the execution to the handler code for making further decisions, such as requiring additional security checks or rejecting the request.

Signature:

consumeAppCheckToken?:boolean;

RuntimeOptions.enforceAppCheck

Determines whether Firebase AppCheck is enforced.

When true, requests with invalid tokens autorespond with a 401 (Unauthorized) error. When false, requests with invalid tokens set context.app to undefiend.

Signature:

enforceAppCheck?:boolean;

RuntimeOptions.failurePolicy

Failure policy of the function, with booleantrue being equivalent to providing an empty retry object.

Signature:

failurePolicy?:FailurePolicy|boolean;

RuntimeOptions.ingressSettings

Ingress settings which control where this function can be called from.

Signature:

ingressSettings?:(typeofINGRESS_SETTINGS_OPTIONS)[number]|ResetValue;

RuntimeOptions.invoker

Invoker to set access control on https functions.

Signature:

invoker?:"public"|"private"|string|string[];

RuntimeOptions.labels

User labels to set on the function.

Signature:

labels?:Record<string,string>;

RuntimeOptions.maxInstances

Max number of actual instances allowed to be running in parallel.

Signature:

maxInstances?:number|Expression<number>|ResetValue;

RuntimeOptions.memory

Amount of memory to allocate to the function.

Signature:

memory?:(typeofVALID_MEMORY_OPTIONS)[number]|Expression<number>|ResetValue;

RuntimeOptions.minInstances

Min number of actual instances to be running at a given time.

Instances will be billed for memory allocation and 10% of CPU allocation while idle.

Signature:

minInstances?:number|Expression<number>|ResetValue;

RuntimeOptions.preserveExternalChanges

Controls whether function configuration modified outside of function source is preserved. Defaults to false.

When setting configuration available in the underlying platform that is not yet available in the Firebase Functions SDK, we highly recommend settingpreserveExternalChanges totrue. Otherwise, when the Firebase Functions SDK releases a new version of the SDK with support for the missing configuration, your function's manually configured setting may inadvertently be wiped out.

Signature:

preserveExternalChanges?:boolean;

RuntimeOptions.secrets

Signature:

secrets?:(string|SecretParam)[];

RuntimeOptions.serviceAccount

Specific service account for the function to run as.

Signature:

serviceAccount?:"default"|string|Expression<string>|ResetValue;

RuntimeOptions.timeoutSeconds

Timeout for the function in seconds, possible values are 0 to 540.

Signature:

timeoutSeconds?:number|Expression<number>|ResetValue;

RuntimeOptions.vpcConnector

Connect cloud function to specified VPC connector.

Signature:

vpcConnector?:string|Expression<string>|ResetValue;

RuntimeOptions.vpcConnectorEgressSettings

Egress settings for VPC connector.

Signature:

vpcConnectorEgressSettings?:(typeofVPC_EGRESS_SETTINGS_OPTIONS)[number]|ResetValue;

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2023-11-21 UTC.