本文介绍了GCloud Functions调试部署失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天刚开始使用GCloud Functions,我遇到了问题.我已经将我的项目之一更新为可以使用函数,并使用Google的local-emulator(@ google-cloud/functions-emulator)调试和测试了我的新功能.一切顺利,模拟器部署进行得很好.```

Just started using GCloud Functions today, and I am having a problem.I've updated one of my projects to be function-ready and used google's local-emulator (@google-cloud/functions-emulator) to debug and test my new function.Everything went well and emulator deployment went just fine.```

$ 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.

```

但是当我尝试使用实际的gcloud beta functions做同样的事情时,我得到了一个构建错误,没有任何理由或明显的方式对其进行调试:

But when i try to do the same thing using the actual gcloud beta functions I get a build error without any reason or obvious way to debug it:

```

$ 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

```

在GClould日志中,我也未获取任何其他详细信息==> https://pastebin.com/6H7DRkE8

In the GClould logs I'm not getting any other details either ==> https://pastebin.com/6H7DRkE8

如何调试此部署问题?

推荐答案

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

After some more research, I've found a way to debug the deployment process. The gcloud tool comes with a set of options which are not easily to spot but offer features like verbosity. And that's what you need for debugging the deployment process. Find all the options here:https://cloud.google.com/sdk/gcloud/reference/alpha/functions/deploy(bottom of the page)

就我而言,问题是私人NPM回购,由于缺少权限,因此不能将其结帐.

In my case, the issue was a private NPM repo which for sure, couldn't be checkout due to lack of permissions.

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

这篇关于GCloud Functions调试部署失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 22:01