Reputation: 571
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)
Upvotes: 0
Views: 994
Reputation: 317808
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.
Upvotes: 2