3

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.

```

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

```

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

How can I debug this deployment issue?

2 Answers 2

8

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)

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

Sign up to request clarification or add additional context in comments.

2 Comments

We'll look into surfacing errors better with the default settings.
I'm getting the same error, has the GCP team found a way to surfacing errors better?
1

I just had this same issue and it was caused by a typo in a module name in package.json/dependencies.

2 Comments

Thank you @tonicblue ! Hmm, double-checked and my deps look ok. Would be nice tho if there would be a way to debug this or some proper error messages...
Agreed. I spent a while trying to work out different ways of getting on top of this and Googling that error only came up with your SO question and paste bin. Glad you got to the bottom of it. In future I will clock this message as being something related to dependencies.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.