Jika Anda membuat fungsi baru, lihat Panduan Memulai Konsol di Cloud Run. Konten di halaman ini hanya berlaku untuk fungsi lama yang sudah ada yang dibuat dengan Cloud Functions v1 API.
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Pemicu Cloud Run Functions (generasi ke-1)
Anda dapat menyiapkan fungsi Cloud Run untuk dieksekusi sebagai respons terhadap berbagai skenario dengan menentukan pemicu untuk fungsi Anda. Pemicu dapat berupa permintaan HTTP(S) atau
salah satu dari sejumlah peristiwa yang didukung. Halaman ini memberikan ringkasan tentang
pemicu yang didukung oleh fungsi Cloud Run.
Secara umum, pemicu dikelompokkan ke dalam dua kategori:
Pemicu HTTP, yang bereaksi terhadap permintaan HTTP(S), dan sesuai dengan
fungsi HTTP.
Pemicu peristiwa, yang bereaksi terhadap peristiwa dalam Google Cloud project Anda, dan sesuai dengan
fungsi yang dipicu peristiwa.
Anda menentukan pemicu sebagai bagian dari
deployment fungsi. Anda tidak dapat mengikat
fungsi yang sama ke lebih dari satu pemicu sekaligus, tetapi Anda dapat memiliki peristiwa
yang sama yang menyebabkan beberapa fungsi dieksekusi dengan men-deploy beberapa fungsi
dengan setelan pemicu yang sama.
Karena fungsi Cloud Run dapat dipicu oleh pesan pada topik Pub/Sub, Anda dapat mengintegrasikan fungsi Cloud Run dengan layanan Google lainnya yang mendukung Pub/Sub sebagai bus peristiwa. Selain itu, dengan menggunakan pemicu HTTP,
Anda juga dapat mengintegrasikan dengan layanan apa pun yang menyediakan callback HTTP (webhook).
Bagian berikut menjelaskan beberapa contoh integrasi.
Cloud Logging
Cloud Logging dapat merutekan log ke topik Pub/Sub, yang kemudian dapat
dipakai oleh fungsi Cloud Run. Lihat
Mengonfigurasi dan mengelola sink dalam
dokumentasi Cloud Logging untuk mengetahui informasi selengkapnya.
Cloud Scheduler
Tugas Cloud Scheduler dapat mengirim pesan ke topik Pub/Sub, yang
kemudian dapat dipakai oleh fungsi Cloud Run. Lihat tutorial Cloud Scheduler
Menggunakan Pub/Sub untuk memicu fungsi Cloud Run
untuk mengetahui informasi selengkapnya.
Cloud Tasks
Dengan tugas Target HTTP Cloud Tasks, Anda dapat menjalankan pengendali tugas di endpoint
HTTP mana pun, sehingga fungsi Cloud Run dengan pemicu HTTP dapat digunakan
sebagai pengendali tugas. Anda juga dapat menggunakan tugas untuk men-throttle atau membatasi kapasitas pemanggilan
fungsi. Lihat
Membuat tugas Target HTTP dalam
dokumentasi Cloud Tasks untuk mengetahui informasi selengkapnya.
Gmail
Dengan menggunakan
Push Notification API Gmail,
Anda dapat mengirim peristiwa Gmail ke topik Pub/Sub dan menggunakannya
dengan fungsi Cloud Run.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-19 UTC."],[[["\u003cp\u003eCloud Run functions can be triggered by HTTP(S) requests or various events within your Google Cloud project.\u003c/p\u003e\n"],["\u003cp\u003eTriggers are categorized into HTTP triggers for HTTP(S) requests and event triggers for events within the Google Cloud project.\u003c/p\u003e\n"],["\u003cp\u003eYou can only bind one trigger to a single function at a time, but you can deploy multiple functions with the same trigger settings for parallel execution.\u003c/p\u003e\n"],["\u003cp\u003eCloud Run functions support a variety of event triggers, including Pub/Sub, Cloud Storage, Firestore, and several Firebase-related triggers.\u003c/p\u003e\n"],["\u003cp\u003eFunctions can be integrated with any Google service that supports Pub/Sub or any external service with HTTP callbacks by using Pub/Sub or HTTP triggers, respectively.\u003c/p\u003e\n"]]],[],null,["# Cloud Run functions triggers (1st gen)\n======================================\n\nYou can set up Cloud Run functions to execute in response to various scenarios by\nspecifying a *trigger* for your function. Triggers can be HTTP(S) requests or\none of a number of supported events. This page provides an overview of the\ntriggers supported by Cloud Run functions.\n\nBroadly, triggers fall into two categories:\n\n- **HTTP triggers** , which react to HTTP(S) requests, and correspond to\n [HTTP functions](/functions/1stgendocs/writing/write-http-functions).\n\n- **Event triggers** , which react to events within your Google Cloud project,\n and correspond to\n [event-driven functions](/functions/1stgendocs/writing/write-event-driven-functions).\n\nYou specify triggers as part of\n[function deployment](/functions/1stgendocs/deploy). You cannot bind the\nsame function to more than one trigger at a time, but you can have the same\nevent cause multiple functions to execute by deploying multiple functions\nwith 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\nSupported triggers\n------------------\n\nCloud Run functions supports the following types of triggers:\n\n- [HTTP triggers](/functions/1stgendocs/calling/http)\n- Event triggers:\n - [Pub/Sub triggers](/functions/1stgendocs/calling/pubsub)\n - [Cloud Storage triggers](/functions/1stgendocs/calling/storage)\n - [Firestore triggers](/functions/1stgendocs/calling/cloud-firestore-1st-gen)\n - [Google Analytics for Firebase triggers](/functions/1stgendocs/calling/google-analytics-firebase)\n - [Firebase Realtime Database triggers](/functions/1stgendocs/calling/realtime-database)\n - [Firebase Authentication triggers](/functions/1stgendocs/calling/firebase-auth)\n - [Firebase Remote Config triggers](/functions/1stgendocs/calling/firebase-remote-config)\n\nAdditional triggers via Pub/Sub and webhooks\n--------------------------------------------\n\nBecause Cloud Run functions can be triggered by messages on a Pub/Sub\ntopic, you can integrate Cloud Run functions with any other Google service that\nsupports Pub/Sub as an event bus. In addition, by using HTTP triggers\nyou can also integrate with any service that provides HTTP callbacks (webhooks).\nThe following sections describe some example integrations.\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\nCloud Scheduler jobs can send messages to a Pub/Sub topic, where\nthey can then be consumed by Cloud Run functions. See the Cloud Scheduler\ntutorial\n[Using Pub/Sub to trigger a Cloud Run function](/scheduler/docs/tut-gcf-pub-sub)\nfor more information.\n\n### Cloud Tasks\n\nCloud Tasks HTTP Target tasks enable you to run task handlers at any\nHTTP endpoint, so a Cloud Run function with an HTTP trigger can be used\nas a task handler. You can also use tasks to throttle or rate-limit function\ninvocations. See\n[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 functions."]]