【发布时间】:2020-10-12 00:39:14
【问题描述】:
我使用谷歌云功能已经有一段时间了。错误处理从来没有任何问题,但是最近,当我在本地主机上停止谷歌云功能时,它会给出以下错误。
^CReceived SIGINT
Received SIGINT
^CReceived SIGINT
Received SIGTERM
^CReceived SIGINT
一段时间后,我发现程序在执行完成后仍在执行,出现以下错误。
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)
很明显,我希望我的程序在按下 ctrl + c 后停止,但它没有。
我添加了一个 SIGINT 事件侦听器,还添加了一个 try-catch 来处理错误并向客户端发送任何类型的错误的响应。还是不行。
目前,我正在手动终止当前进程,这并不理想。
任何帮助表示赞赏。
【问题讨论】:
-
您的问题是本地问题还是 GCF 问题?
-
如果可能的话,您能否分享一下您的 Cloud Function 使用的代码?这将帮助我们了解是否有可以改进的地方
-
这是本地的问题,代码并不重要,只是导入数据的基本谷歌功能,而只是在执行时您不能停止进程。
标签: javascript node.js google-cloud-platform google-cloud-functions