3
votes

I have this function to handle contact submissions. It get's triggered onCreate for a document in a collection in Firestore. The function is using the new v1+ syntax and it works every time I deploy the function to Firebase.

I'm getting a weird behavior where the function works fine for a couple of weeks and then it stops working. I can see new documents being created on the collection but the function doesn't gets triggered.

There are no logs or errors in the console for the function. The trigger for the function in the dashboard clearly states:

document.create
/someCollection/{documentId}

Once I redeploy the same function (no change is done to the code) the function start triggering as normal.

Have anyone seen this behavior?

1
There's not much we can do without seeing code and understanding how documents get created in the system. If you feel this is a bug, please report that here: firebase.google.com/support/contact/bugs-featuresDoug Stevenson
Yes, I have encountered this exact problem too. There is no error on the codes but after a few weeks of not triggering the functions, it stopped working and i need to redeploy it to make it work againthe newbie coder
same issue here after re deploying, it started working. :( it was triggering but after while it stopped working.Wilson
@Wilson yes I still keep seeing the same issue. The function stopped working after a couple of weeks of inactivity. I might report a bug after all.David Garcia
@DavidGarcia Just realized I have the same problem. Functions not used for a longer period of time stopped triggering. Redeploying fixes the issue. Have you found a solution by any chance?Rafal Zawadzki

1 Answers

1
votes

Solution: redeploy your functions and the problem should not happen ever again.


According to the Firebase documentation:

Max inactivity time for background functions = 30 days

The maximum amount of time that a background function can be kept without any invocation. Functions that are not invoked even once during this time may enter a state in which new events will not trigger them anymore. If this happens, such functions have to be redeployed to start working again. Note: This inactive state is not reflected in the UI, CLI, or API in any way.

However, a Firebase team member commented in another SO thread:

This limitation was removed as of today. You will have to redeploy your Cloud Functions one final time, but after that they shouldn't be auto-removed after 30 days anymore.