调试部署失败的GCloud Functions

mae*_*sto 2 node.js gcloud serverless-framework

刚刚开始使用GCloud Functions,我遇到了问题.我已将我的一个项目更新为功能就绪,并使用谷歌local-emulator(@ google-cloud/functions-emulator)来调试和测试我的新功能.一切顺利,模拟器部署进行得很顺利.```

$ functions deploy doThing --trigger-http --timeout=540s
Copying file:///var/folders/nw/.../T/us-central1-doThing-....zip...
Waiting for operation to finish...done.
Deploying function.......done.
Function doThing deployed.
Run Code Online (Sandbox Code Playgroud)

```

但是当我尝试使用实际的相同的东西gcloud beta functions我得到一个构建错误没有任何理由或明显的方式来调试它:

```

$ gcloud beta functions deploy doThing --stage-bucket test-bucket --trigger-http --timeout=360s
Copying file:///var/folders/nw/.../T/tmpUJvuxd/fun.zip [Content-Type=application/zip]...
| [1 files][  7.5 MiB/  7.5 MiB]
Operation completed over 1 objects/7.5 MiB.
Deploying function (may take a while - up to 2 minutes)...failed.
ERROR: (gcloud.beta.functions.deploy) OperationError: code=13, message=Error in the build environment
Run Code Online (Sandbox Code Playgroud)

```

在GClould日志中,我没有得到任何其他细节==> https://pastebin.com/6H7DRkE8

如何调试此部署问题?

mae*_*sto 5

经过一些研究,我找到了一种调试部署过程的方法.该gcloud工具附带了一组选项,这些选项不易发现,但提供了类似的功能verbosity.这就是调试部署过程所需的.在此处查找所有选项:https: //cloud.google.com/sdk/gcloud/reference/alpha/functions/deploy (页面底部)

在我的情况下,问题是私人NPM回购,由于缺乏权限,肯定无法结账.

gcloud beta functions deploy <NAME> --stage-bucket <BUCKET> --verbosity debug