谷歌云功能不处理签名

Rah*_*ati 5 javascript node.js google-cloud-platform google-cloud-functions

我一直在使用谷歌云功能一段时间。错误处理从来没有任何问题,但最近,当我在本地主机上停止谷歌云功能时,它给出了以下错误。

^CReceived SIGINT
Received SIGINT
^CReceived SIGINT
Received SIGTERM
^CReceived SIGINT
Run Code Online (Sandbox Code Playgroud)

一段时间后,我发现程序在执行完成后仍在执行,出现以下错误。

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)
Run Code Online (Sandbox Code Playgroud)

很明显,我希望我的程序在按下ctrl + c 后停止,但事实并非如此。

我添加了一个 SIGINT 事件侦听器,还添加了一个 try-catch 来处理错误并向客户端发送任何类型的错误响应。它仍然无法正常工作。

目前,我正在手动终止当前的进程,这并不理想。

任何帮助表示赞赏。

小智 3

是的,这很愚蠢。我没有解决方案,但我的解决方法是:

  • Ctrl+C
  • 从浏览器中点击 URL

由于某种原因,这会杀死它。