Events and Triggers
These are the basic Firebase and Google Cloud Platform events and triggers.
Events are things that happen within your cloud environment that you might want to take action on. These might be changes to data in a database, files added to a storage system, or a new virtual machine instance is created. Currently, Cloud Functions supports events from the following providers:
- Cloud Logging—forward log entries to a Pub/Sub topic by creating a sink. You can then trigger the function.
- onCreate: triggered when a document is written to for the first time.
- onUpdate: triggered when a document already exists and has any value changed.
- onDelete: triggered when a document with data is deleted.
- onWrite: triggered when onCreate, onUpdate or onDelete is triggered.
- onWrite(): triggered when data is created, updated, or deleted in the Realtime Database.
- onCreate(): which triggered when new data is created in the Realtime Database.
- onUpdate():which triggered when data is updated in the Realtime Database.
- onDelete(): which triggered when data is deleted from the Realtime Database.
You can trigger a function in response to Firebase Remote Config events, including the publication of a new config version or the rollback to an older version.
Firebase accounts will trigger user creation events for Cloud Functions when:
- A user creates an email account and password.
- A user signs in for the first time using a federated identity provider.
- The developer creates an account using the Firebase Admin SDK.
- A user signs in to a new anonymous auth session for the first time.
Cloud Functions supports the Google Analytics AnalyticsEvent. This event is triggered whenever user activity generates a conversion event. For example, you could write a function that triggers when the in_app_purchase event is generated, indicating that an in-app purchase has occurred. You must specify the Analytics event that you want to trigger your function using the functions.analytics.event() method, and handle the event within the onLog() event handler.
- onArchive: Only sent when a bucket has enabled object versioning. This event indicates that the live version of an object has become an archived version, either because it was archived or because it was overwritten by the upload of an object of the same name.
- onDelete: Sent when an object has been permanently deleted. This includes objects that are overwritten or are deleted as part of the bucket's lifecycle configuration. For buckets with object versioning enabled, this is not sent when an object is archived (see onArchive), even if archival occurs via the storage.objects.delete method.
- onFinalize: Sent when a new object (or a new generation of an existing object) is successfully created in the bucket. This includes copying or rewriting an existing object. A failed upload does not trigger this event.
- onMetadataUpdate: Sent when the metadata of an existing object changes.
You can trigger a function whenever a new Pub/Sub message is sent to a specific topic. You must specify the Pub/Sub topic name that you want to trigger your function, and set the event within the onPublish() event handler.
Create a new function that triggers when a TestMatrix completes with the event handler functions.testLab.testMatrix().onComplete().
Type of event. Possible values are: