I was playing around with Firebase Cloud Functions and I ended up creating a function stuck in an infinite loop which was executed over 30k times in two days. Luckily for me, billing wasn't enabled.
Is there a way to prevent this from happening? For example:
a. Receiving an alert if the same function is running too many times in a short period of time;
b. Preventing a function with an onUpdate (or onWrite) trigger to run multiple times when the action is coming from an admin (nodeJS) rather than a regular user.
The latter was my issue here. I had an onUpdate trigger which would update the document with the number of times that document had been edited. However, obviously, every time I was updating the document, then my function would run again.
I'm worried one day I (or someone from my team) will make a mistake like that and we'll end up with a huge bill to pay.