CloudFunction interface

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

A handler for CloudEvents.

Signature:

exportinterfaceCloudFunction<EventTypeextendsCloudEvent<unknown>>

Properties

PropertyTypeDescription
__endpointManifestEndpoint
__triggerunknown

Methods

MethodDescription
run(event)(BETA) The callback passed to the CloudFunction constructor. Use run to test a function.

CloudFunction.__endpoint

Signature:

__endpoint:ManifestEndpoint;

CloudFunction.__trigger

Signature:

__trigger?:unknown;

CloudFunction.run()

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

The callback passed to the CloudFunction constructor. Use run to test a function.

Signature:

run(event:EventType):any|Promise<any>;

Parameters

ParameterTypeDescription
eventEventTypeThe parsed event to handle.

Returns:

any | Promise<any>

Any return value. Cloud Functions awaits any promise before shutting down your function. Resolved return values are only used for unit testing purposes.