英文:
Eventarc to trigger Cloud Run by Firestore document creation event
问题
我正在尝试为当新的Firestore文档被添加时触发Cloud Run时设置基本的Eventarc触发器。
我按照下面截图所示的方式设置了它(区域:全球;资源:任何)。然后我在Firestore中创建了一个新文档(数据库位置:europe-west3
)。但是在europe-north1
的Cloud Run服务并没有被触发;而且在触发器监控中也没有关于事件的任何信息显示(请参见截图)。
我做错了什么?
英文:
I am trying to set up a basic Eventarc trigger for triggering Cloud Run when a new Firestore document is added.
I set it up as depicted in the screenshot below (region: global; resource: any). Then I create a new document in Firestore (database location: europe-west3
). The Cloud Run service in europe-north1
does not get triggered; moreover, no information about the event shows up in the trigger monitoring (see the screenshot).
What am I doing wrong?
答案1
得分: 1
以下是翻译好的部分:
"It took me a day, but here is the thing. To use Eventarc for Firestore events, you need to enable Compute Engine API audit logging, NOT the Firestore/Datastore API. You can do that in IAM and admin -> Audit logs.
It does not seem self-evident to me. It would be nice if the documentation had that explicitly about the Firestore vs. Compute Engine APIs.
Here is the configuration that works:
英文:
It took me a day, but here is the thing. To use Eventarc for Firestore events, you need to enable Compute Engine API audit logging, NOT the Firestore/Datastore API. You can do that in IAM and admin -> Audit logs.
It does not seem self-evident to me. It would be nice if the documentation had that explicitly about the Firestore vs. Compute Engine APIs.
答案2
得分: 0
根据文档,在向Firestore
数据库添加文档后,有一个更适合触发Cloud Run
服务的事件示例:
gcloud eventarc triggers create your-trigger \
--location ${REGION} --service-account your-sa-email \
--destination-run-service your-service \
--event-filters type=google.cloud.audit.log.v1.written \
--event-filters methodName=google.firestore.v1.Firestore.CreateDocument \
--event-filters serviceName=firestore.googleapis.com
在这个示例中,我使用了一个事件筛选器,其中 methodName=google.firestore.v1.Firestore.CreateDocument
。
英文:
According to the documentation, there is a more adapted event to trigger a Cloud Run
service after adding a document in the Firestore
database, example :
gcloud eventarc triggers create your-trigger \
--location ${REGION} --service-account your-sa-email \
--destination-run-service your-service \
--event-filters type=google.cloud.audit.log.v1.written \
--event-filters methodName=google.firestore.v1.Firestore.CreateDocument \
--event-filters serviceName=firestore.googleapis.com
In this example I used an event filter with methodName=google.firestore.v1.Firestore.CreateDocument
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论