firebase-tools
firebase-tools copied to clipboard
Firebase Emulator : Cloud functions not always get triggered on firestore creation
[REQUIRED] Version info
node: 20
firebase-functions:^4.7.0
firebase-tools:
firebase-admin:
[REQUIRED] Test case
Deploy function onCreate event
const functions = require("firebase-functions");
exports.purchases = functions.firestore
.document("adata/{a}/bdata/{b}/cdata/{c}/ddata/{d}")
.onCreate(async (snap, context) => {
}
Insert data on Firestore
WriteBatch batch = firestore.batch();
batch.set(
firestore.collection('adata/$a/bdata/$b/cdata/$c/ddata').doc(),
{'list': FieldValue.arrayUnion(myLists)});
....
//another batch.set
...
batch.commit();
[REQUIRED] Steps to reproduce
- Run the cloud function script and firestore using firebase emulator.
- Begin inserting data to firestore
[REQUIRED] Expected behavior
All document created need to be triggered upon successfully write on Firestore.
[REQUIRED] Actual behavior
Few document were not getting triggered upon successfully write on Firestore. Surprisingly , once a trigger failed, the next document created will be successfully trigger the cloud function.
Were you able to successfully deploy your functions?
Yes
When you ran firebase deploy
, did you see any error messages?
No
The emulator suite is not part of the firebase-functions SDK. The Firestore team owns the Firestore emulator, not the functions team, so this issue has been unfortunately waiting for the wrong audience.
I'll dig into this a bit to see who the appropriate assignee is.