我的一个云函数在firebase上退出,代码16是一个错误。
我试着谷歌,找出代码是什么,但一点运气都没有。
Error: Process exited with code 16
at process.on.code (/srv/node_modules/@google-cloud/functions-framework/build/src/invoker.js:393:29)
at process.emit (events.js:189:13)
at process.EventEmitter.emit (domain.js:441:20)
at process.exit (internal/process/per_thread.js:168:15)
at logAndSendError (/srv/node_modules/@google-cloud/functions-framework/build/src/invoker.js:184:9)
at process.on.err (/srv/node_modules/@google-cloud/functions-framework/build/src/invoker.js:390:13)
at process.emit (events.js:189:13)
at process.EventEmitter.emit (domain.js:441:20)
at emitPromiseRejectionWarnings (internal/process/promises.js:119:20)
at process._tickCallback (internal/process/next_tick.js:69:34)在哪里可以找到报告的错误代码,以便了解函数退出的原因?
发布于 2020-11-23 14:31:18
函数框架的代码实际上是在GoogleCloudPlatform/functions-framework-nodejs存储库中公开的(尽管没有在任何地方做广告)。
特别是,您可以看到使用killInstance的情况,这是触发退出代码16的情况:
const killInstance = process.exit.bind(process, 16);
这些案件(在编写本报告时)是:
发布于 2019-07-23 12:25:15
显然,经过调查,这个错误意味着:Headers already sent。
我的代码中有一个带有头的response.send(),然后,我发送了另一个响应。
如果Firebase团队能够详细说明这些问题并提供一些文档,而不是让我们蒙上眼睛(据我理解),那就太好了。
发布于 2020-01-10 20:39:44
不恰当地终止云功能是可能的原因。
以下是[消]火源文档所说的话:
res.redirect()、res.send()或res.end()终止HTTP函数。return;语句终止同步函数。简而言之,注意浮动承诺和/或对res或response的多次调用。
我还看到Process exited with code 16是与以下内容同时发生的:
Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.
at GoogleAuth.getApplicationDefaultAsync (/srv/functions/node_modules/google-auth-library/build/src/auth/googleauth.js:161:19)
at process._tickCallback (internal/process/next_tick.js:68:7)https://stackoverflow.com/questions/57149416
复制相似问题