[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-21。"],[],[],null,["# Cloud Run function triggers\n\nAfter you [create and deploy your Cloud Run function](/run/docs/deploy-functions),\nyou can set your function to execute in response to various scenarios by\nspecifying a trigger. This page provides an overview of the triggers supported\nby Cloud Run functions.\n\nTypes of triggers\n-----------------\n\nBy default, all functions deployed on Cloud Run are\n[Cloud Run source-deployed services](/run/docs/resource-model#source)\nthat have an HTTP endpoint (`run.app` URL). If you previously created a function\nwith the [`gcloud functions` command](/functions/docs/deploy) or the\n[Cloud Functions v2 API](/functions/docs/apis), by default, the function\nhas a `cloudfunctions.net` HTTP endpoint.\n\nHow your function is invoked or triggered depends on the type of function you\nspecify when [writing your code](/run/docs/write-functions#signature_type).\n\n- **Event-driven triggers** : Reacts to events within your Google Cloud project and corresponds to [event-driven functions](/run/docs/write-event-driven-functions) (also called *CloudEvent functions*). You must use Eventarc, Google's implementation of the CloudEvents spec that supports building event-driven architectures, to trigger functions in response to specified events.\n- **HTTP triggers** : Reacts to HTTP(S) requests and correspond to [HTTP functions](/run/docs/write-http-functions). You can use other Google Cloud services (non-Eventarc) as an event provider to invoke the function through HTTP(S) requests.\n\nTo trigger a function to react to events within your Google Cloud project,\nyou specify triggers as part of deploying the function in the Google Cloud console\nor after function is deployed when using the gcloud CLI.\n\nYou cannot bind the same function to more than one trigger at a time, but you\ncan have the same event cause multiple functions to execute by deploying\nmultiple functions with the same trigger settings.\n| **Note:** Trigger binding does not happen instantaneously. It may take several minutes for a deployed function to start triggering on incoming events.\n\nExample triggers\n----------------\n\nThe following are example triggers supported by\nCloud Run functions:\n\n- Event-driven triggers:\n\n - [Pub/Sub events triggered by Eventarc](/run/docs/triggering/pubsub-triggers)\n - [Cloud Storage events triggered by Eventarc](/run/docs/triggering/storage-triggers)\n - [Firestore events triggered by Eventarc](/run/docs/triggering/firestore-triggers)\n - [Other event triggers](/run/docs/triggering/trigger-with-events)\n - Supports any [event type supported by Eventarc](/eventarc/docs/reference/supported-events), including 90+ event sources using Cloud Audit Logs\n- HTTP triggers:\n\n - [Invoke with an HTTP request](/run/docs/triggering/https-request)\n - [Invoke services as part of a workflow with Workflows](/run/docs/triggering/invoke-services-from-workflows)\n - [Invoke services on a schedule with Cloud Scheduler](/run/docs/triggering/using-scheduler)\n - [Use Cloud Tasks to execute asynchronous tasks](/run/docs/triggering/using-tasks)\n - [Trigger services from a Pub/Sub push subscription](/run/docs/tutorials/pubsub)\n - Pub/Sub messages can be routed directly to a function through HTTP requests or wrapped under Eventarc as an event-driven trigger.\n\nAll event-driven functions use Eventarc for event delivery.\nPub/Sub triggers and Cloud Storage triggers are implemented as\nparticular types of Eventarc triggers.\n| **Note:** Eventarc does not support direct events from Google Analytics for Firebase, or Firebase Authentication.\n\nAdditional triggers using Pub/Sub and webhooks\n----------------------------------------------\n\nBecause Cloud Run functions can be triggered by messages on a\nPub/Sub topic, you can integrate Cloud Run functions with any\nother Google service that supports Pub/Sub as an event bus. In addition,\nby using HTTP triggers you can also integrate with any service that provides\nHTTP callbacks (webhooks). The following sections describe some example\nintegrations.\n\n### Cloud Logging\n\nCloud Logging can route logs to a Pub/Sub topic, where they can then\nbe consumed by Cloud Run functions. See\n[Configure and manage sinks](/logging/docs/export/configure_export_v2) in the\nCloud Logging documentation for more information.\n\n### Cloud Scheduler\n\nYou can schedule an HTTP function by creating a Cloud Scheduler job\nthat triggers an action using HTTP.\n\nYou can also schedule an event-driven function when your function should be triggered\ndirectly in response to events within your Google Cloud project; for example, when a\nmessage is published to a Pub/Sub topic.\n\n### Cloud Tasks\n\nCloud Tasks HTTP Target tasks enable you to run task handlers at any\nHTTP endpoint, so an HTTP function with an HTTP trigger can be used as a task\nhandler. You can also use tasks to throttle or rate-limit function invocations.\nSee [Create HTTP Target tasks](/tasks/docs/creating-http-target-tasks) in the\nCloud Tasks documentation for more information.\n\n### Gmail\n\nUsing the Gmail\n[Push Notification API](https://developers.google.com/gmail/api/guides/push),\nyou can send Gmail events to a Pub/Sub topic and consume them\nwith Cloud Run."]]