I have been working with google cloud functions for a while. There was never any issue with the error handling but lately, when I stop google cloud function on the localhost it gives out the following error.
^CReceived SIGINT
Received SIGINT
^CReceived SIGINT
Received SIGTERM
^CReceived SIGINT
After some time I find out that the program is still executing once the execution is complete the following errors arise.
Error: Process exited with code 0
at process.<anonymous> (/Applications/XAMPP/xamppfiles/htdocs/web-dev/firestore-scripts/node_modules/@google-cloud/functions-framework/build/src/invoker.js:396:29)
at process.emit (events.js:310:20)
at process.EventEmitter.emit (domain.js:482:12)
at process.exit (internal/process/per_thread.js:166:15)
at Server.<anonymous> (/Applications/XAMPP/xamppfiles/htdocs/web-dev/firestore-scripts/node_modules/@google-cloud/functions-framework/build/src/invoker.js:402:29)
at Object.onceWrapper (events.js:416:28)
at Server.emit (events.js:322:22)
at Server.EventEmitter.emit (domain.js:482:12)
at emitCloseNT (net.js:1657:8)
at processTicksAndRejections (internal/process/task_queues.js:83:21)
Well clearly I want my program to stop once I press ctrl + c but it doesn't.
I have added a SIGINT event listener and also added a try-catch to handle errors and send responses to clients for any kind of error. It is still not working.
For now, I'm manually killing off the current process which is not ideal to do.
Any help appreciated.