firebase-once v0.1.2
Firebase Once
Firebase Functions call triggers more than once which confuses people and causes bugs in apps.
If you use Functions and Firestore triggers and not aware about the idempotency issue, you might have bugs without knowing it.
Firebase Once solves the problem by using claim documents in Firestore. It creates claims in transactions which ensures that the callback function is called only once.
The problem
Firebase Functions triggers documentation states:
Note: Events are delivered at least once, which means that rarely, spurious duplicates can occur.
Which means that triggers could be called more than once on a single event, i.e. on new document in a Firestore collection. That makes
See issue in Firebase SDK for Cloud Functions.
Installation
The library is available as an npm package. To install the package run:
npm install firebase-once --save
# or with yarn
yarn add firebase-once