Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I trigger a firebase cloud function BEFORE document write? [duplicate]

Firebase Cloud Functions has a onWrite trigger, but does it have something like a beforeWrite trigger? If not, what is the simplest way to achieve this?

like image 263
Brendan Avatar asked Mar 17 '26 02:03

Brendan


1 Answers

This is not possible with Cloud Functions. They only trigger after some action occurs. The events received describe the action. This is true for all types of event providers, not just Firestore.

The only way to reliably prevent something from happening is to use a security rule that rejects a read or write.

like image 91
Doug Stevenson Avatar answered Mar 19 '26 20:03

Doug Stevenson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!