I’m trying to set up a bridge between Firestore and Cloud Run using a 2nd Gen Cloud Function and Pub/Sub, but the Cloud Function is not triggered when a new document is created.
The Setup:
-
Database: Firestore in
nam5(multi-region),(default)database. -
Cloud Function: 2nd Gen, Python 3.12, located in
us-central1. -
Trigger: Eventarc (Provider: Cloud Firestore, Event:
google.cloud.firestore.document.v1.created). -
Trigger Region:
nam5. -
Filter:
document: host_messages/{messageId}.
The Problem: When I create a document in host_messages collection (manually in the console or via app), no logs appear in the Cloud Function. It seems the event is never received by Eventarc.
What I’ve checked:
-
IAM Roles: The Compute Engine default service account has
Eventarc Event Receiver,Pub/Sub Publisher, andCloud Run Invoker. -
Service Agent: I’ve granted
roles/eventarc.eventReceivertoservice-PROJECT_NUMBER@gcp-sa-firestore.iam.gserviceaccount.com. -
Path: I’ve tried both
host_messages/{messageId}and the full resource pathprojects/MY_PROJECT/databases/(default)/documents/host_messages/{messageId}.
What am I missing to make Eventarc actually “see” the Firestore creation event in a multi-region setup?