Cloud Run function triggers Stay organized with collections Save and categorize content based on your preferences.
After youcreate and deploy your Cloud Run function,you can set your function to execute in response to various scenarios byspecifying a trigger. This page provides an overview of the triggers supportedby Cloud Run functions.
Types of triggers
By default, all functions deployed on Cloud Run areCloud Run source-deployed servicesthat have an HTTP endpoint (run.app URL). If you previously created a functionwith thegcloud functions command or theCloud Functions v2 API, by default, the functionhas acloudfunctions.net HTTP endpoint.
How your function is invoked or triggered depends on the type of function youspecify whenwriting your code.
- Event-driven triggers: Reacts to events within your Google Cloud project andcorresponds toevent-driven functions(also calledCloudEvent functions). You must use Eventarc,Google's implementation of the CloudEvents spec that supports buildingevent-driven architectures, to trigger functions in response to specifiedevents.
- HTTP triggers: Reacts to HTTP(S) requests and correspond toHTTP functions. You can use otherGoogle Cloud services (non-Eventarc) as an event provider to invoke thefunction through HTTP(S) requests.
To trigger a function to react to events within your Google Cloud project,you specify triggers as part of deploying the function in the Google Cloud consoleor after function is deployed when using the gcloud CLI.
You cannot bind the same function to more than one trigger at a time, but youcan have the same event cause multiple functions to execute by deployingmultiple functions with the same trigger settings.
Note: Trigger binding does not happen instantaneously. It may take severalminutes for a deployed function to start triggering on incoming events.Example triggers
The following are example triggers supported byCloud Run functions:
Event-driven triggers:
- Pub/Sub events triggered by Eventarc
- Cloud Storage events triggered by Eventarc
- Firestore events triggered by Eventarc
- Other event triggers
- Supports anyevent type supported by Eventarc,including 90+ event sources using Cloud Audit Logs
HTTP triggers:
- Invoke with an HTTP request
- Invoke services as part of a workflow with Workflows
- Invoke services on a schedule with Cloud Scheduler
- Use Cloud Tasks to execute asynchronous tasks
- Trigger services from a Pub/Sub push subscription
- Pub/Sub messages can be routed directly to afunction through HTTP requests or wrapped under Eventarc asan event-driven trigger.
All event-driven functions use Eventarc for event delivery.Pub/Sub triggers and Cloud Storage triggers are implemented asparticular types of Eventarc triggers.
Note: Eventarc does not support direct events fromGoogle Analytics for Firebase, or Firebase Authentication.Additional triggers using Pub/Sub and webhooks
Because Cloud Run functions can be triggered by messages on aPub/Sub topic, you can integrate Cloud Run functions with anyother Google service that supports Pub/Sub as an event bus. In addition,by using HTTP triggers you can also integrate with any service that providesHTTP callbacks (webhooks). The following sections describe some exampleintegrations.
Cloud Logging
Cloud Logging can route logs to a Pub/Sub topic, where they can thenbe consumed by Cloud Run functions. SeeConfigure and manage sinks in theCloud Logging documentation for more information.
Cloud Scheduler
You can schedule an HTTP function by creating a Cloud Scheduler jobthat triggers an action using HTTP.
You can also schedule an event-driven function when your function should be triggereddirectly in response to events within your Google Cloud project; for example, when amessage is published to a Pub/Sub topic.
Cloud Tasks
Cloud Tasks HTTP Target tasks enable you to run task handlers at anyHTTP endpoint, so an HTTP function with an HTTP trigger can be used as a taskhandler. You can also use tasks to throttle or rate-limit function invocations.SeeCreate HTTP Target tasks in theCloud Tasks documentation for more information.
Gmail
Using the GmailPush Notification API,you can send Gmail events to a Pub/Sub topic and consume themwith Cloud Run.
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 2025-12-17 UTC.