Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

process.exit(0) in cloud function finishes with status: 'crash'

I’m terminating cloud function with process.exit(0). It does terminate my function but throws this line in the logs:

finished with status: ‘crash’

Does this mean that such a function completion has some pitfalls? Such a strong word in logs is a little scary)

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Exiting the process is not at all what you’re supposed to do. I suggest reviewing the documentation on function termination. If you have a background function (trigger), you must return a promise that indicates when any async work is complete. For HTTP functions, you must send a response and return. Nowhere will you see any documentation or examples that involve exiting the process, as that kills the node process that would normally serve many requests during its lifetime.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading