GCP Cloud Functions not triggering on Firestore document creation despite correct setup
I keep running into I'm having trouble getting a Cloud Function in GCP to trigger on Firestore document creation events. I've set up the function to listen to a specific Firestore collection, but it seems like the function is never invoked when new documents are added. I've double-checked the IAM permissions, and the service account associated with the Cloud Function has the necessary permissions on Firestore. Here's the relevant part of my function code: ```javascript const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp(); exports.onDocumentCreate = functions.firestore.document('myCollection/{docId}') .onCreate((snapshot, context) => { const newValue = snapshot.data(); console.log('New document created:', newValue); // Additional processing logic here }); ``` The function is deployed successfully, and I can see it in the Cloud Functions dashboard. However, when I add a new document to `myCollection`, I don't see any logs in the Cloud Functions logs indicating that the function was triggered. I also tried changing the document path to `myCollection/{docId}` to `myCollection/{docId}/someSubCollection/{subDocId}` to see if it was a path issue, but that didnβt work either. Additionally, I verified that Firestore's rules allow read/write access for the function. Hereβs a snippet of my Firestore security rules: ```plaintext service cloud.firestore { match /databases/{database}/documents { match /myCollection/{docId} { allow read, write: if request.auth != null; } } } ``` I'm currently using Firebase Functions SDK version 3.14.1 with Node.js 14. What else could I check or try to resolve this issue? Any insights would be greatly appreciated! I'm working on a mobile app that needs to handle this. This is part of a larger microservice I'm building.