I'm using the following approach (source) to build a GCP Cloud Function that handles Firestore events.
const functions = require('firebase-functions');
exports.myFunction = functions.firestore
.document('my-collection/{docId}')
.onWrite((change, context) => { /* ... */ });
There is no example on how to deploy this correctly to GCP Functions though, only Firebase ones. using the regular gcloud deploy commands such as this one won't work.
gcloud functions deploy FUNCTION_NAME \
--entry-point ENTRY_POINT \
--runtime RUNTIME \
--trigger-event "providers/cloud.firestore/eventTypes/document.write" \
--trigger-resource "projects/YOUR_PROJECT_ID/databases/(default)/documents/messages/{pushId}"
Any ideas on how to do this?