firebase / firebase/firebase-tools

Firebase Emulator : Cloud functions not always get triggered on firestore creation

Open
#6,833 1 comment 0 reactions 0 assignees View on GitHub
api: firestore
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

### [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

1. Run the cloud function script and firestore using firebase emulator.
2. 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.