Firestore trigger cost implications

Viewed 701

Being on the Blaze plan, what are the cost implications when it comes to firestore triggers?

Do I assume correctly that a trigger by itself doesn't generate any extra reads from database?

I still have a feeling that triggers are not free from perspective of CPM/memory consumption. And from that perspective do I understand correctly that firestore triggers can be treated just like any other firebase functions?

2 Answers

According to the Firebase docs:

Firestore Triggers
With Cloud Functions, you can handle events in Cloud Firestore with no need to update client code.

So Firestore triggers can only be done via Cloud Functions. For cloud functions there are costs for running a function (https://firebase.google.com/pricing) and the costs of listening to changes (snapshots) or reading/writing to Firestore will be added to that. Depending on what you are planning to do you also have to account for the internet traffic generated between the Firestore and the Cloud Functions, but this depends on some variables.

So, yes you are correct.

The Firestore document that triggers your Cloud Function is included in the context. There is no document read or bandwidth charge for accessing this document.

You will be charged for the invocation and CPU/memory usage of the Cloud Function itself, as well as for any additional Firestore access you perform inside your Function's code.

Related