You can create an Eventarc trigger that lets a supported event trigger a Cloud Run function. You can configure a trigger when you create or deploy a function, or for an existing function, using the Google Cloud CLI or the Google Cloud console.
You can also trigger Cloud Run functions in response to custom events published to an Eventarc channel.
Create an Eventarc trigger
Create an Eventarc trigger so that your Cloud Run function receives notifications of a specific event or set of events. By specifying filters for the trigger, you can configure the routing of the event, including the event type and source. For more information on how to configure an Eventarc trigger for Cloud Run functions, see Create a trigger for functions.
Before you create a trigger and deploy your function, make sure that you grant the required Identity and Access Management (IAM) roles to your deployer principal, trigger service account, and Google service agents. For more information, see Roles and permissions for Cloud Run functions targets and All roles and permissions.
The following event types can trigger requests to your function:
- An audit log is created that matches the trigger's filter criteria
- A direct event occurs such as an update to a Cloud Storage bucket or an update to a Firebase Remote Config template
- A message is published to a Pub/Sub topic
Trigger functions with custom events
You can trigger Cloud Run functions in response to custom events. These are events produced by special or additional event providers, as opposed to the built-in Firebase events supported by the Firebase SDK for Cloud Run functions, and that are published to an Eventarc channel. For more information, see Create and handle custom event triggers.