Cannot apply path pattern for firestore in EventArc

594 Views Asked by At

I was trying to use EventArc to monitor Firestore changes, which will trigger a Cloud Run service.

It works by listening to Any Resource or specific resource name.

Resource name
projects/PROJECT_Id/databases/(default)

enter image description here

It works, but it will listen to all changes in firestore. However, I want to filter the event to a specific collection. I have tried a few combinations to the pattern, and none of them works. E.g.

projects/PROJECT_Id/databases/(default)/users/*
projects/PROJECT_Id/databases/(default)/users/{user}

Any ideas? Thanks :)

1

There are 1 best solutions below

5
On

I have seen in the image you shared, under the “Resource” section you selected “specific resource” instead can you try to change it to a “path pattern” and you will be able to write a specific path that the trigger object needs to respect.

You can refer to this documentation for Applying a path pattern when filtering in Eventarc.

You can also check out the AuditLog step of Trigger Cloud Run with events from Eventarc codelab for an example on how to use path patterns.