Why can't I deploy to GAE using the gcloud command in go? - google-app-engine

I'm trying to deploy an application written in go to GAE. When I call gcloud app deploy it says this:
Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build 64850a38-3b7b-4223-97bc-27643b8ab1d5 status: FAILURE.
Build error details: go build: cannot use -o with multiple packages
.
Check the build log for errors: https://console.cloud.google.com/gcr/builds/64850a38-3b7b-4223-97bc-27643b8ab1d5?project=609165667740
I have looked everywhere but I can't find information related to this error in this context.

Related

Why would an AppEngine deploy fail with a build failure?

I started working on an app and suddenly it fails to deploy to appengine, with the following error message:
siim#pebble:~/projects/xyz$ gcloud app deploy
Services to deploy:
descriptor: [/home/siim/projects/xyz/app.yaml]
source: [/home/siim/projects/xyz]
target project: [xyz]
target service: [default]
target version: [20220313t182940]
target url: [https://xyz.uc.r.appspot.com]
target service account: [App Engine default service account]
Do you want to continue (Y/n)? y
Beginning deployment of service [default]...
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 2 files to Google Cloud Storage ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build 016c4604-6ea6-47df-8144-e7f1471c6df6 status: FAILURE
removing /layers/google.go.gomod/gopath: unlinkat /layers/google.go.gomod/gopath/pkg/mod/github.com/golang/protobuf#v1.3.1/regenerate.sh: permission denied
Full build logs: https://console.cloud.google.com/cloud-build/builds;region=us-central1/016c4604-6ea6-47df-8144-e7f1471c6df6?project=576574664421
Clicking through to the build log, I see:
===> DETECTING
google.go.appengine_gomod 0.9.0
google.go.gomod 0.9.0
google.go.build 0.9.0
google.go.appengine 0.9.0
google.utils.label 0.0.2
===> ANALYZING
Previous image with name "us.gcr.io/xyz/app-engine-tmp/app/default/ttl-18h:69af35b6-6fc6-4167-88f3-da16f9cfc7e7" not found
Restoring metadata for "google.go.gomod:gopath" from cache
===> RESTORING
Restoring data for "google.go.gomod:gopath" from cache
===> BUILDING
=== App Engine Gomod (google.go.appengine_gomod#0.9.0) ===
--------------------------------------------------------------------------------
Running "cp --dereference -R . /layers/google.go.appengine_gomod/srv"
Done "cp --dereference -R . /layers/google.go.appengine_gomod/srv" (53.220262ms)
=== Go - Gomod (google.go.gomod#0.9.0) ===
DEBUG: go.mod SHA has changed: clearing GOPATH layer's cache
Failure: (ID: f51775d1) removing /layers/google.go.gomod/gopath: unlinkat /layers/google.go.gomod/gopath/pkg/mod/github.com/golang/protobuf#v1.3.1/regenerate.sh: permission denied
--------------------------------------------------------------------------------
Running "mv -f /builder/outputs/output-5577006791947779410 /builder/outputs/output"
Done "mv -f /builder/outputs/output-5577006791947779410 /builder/o..." (5.980458ms)
ERROR: failed to build: exit status 1
I'm completely mystified by this. AFAICT this is something AppEngine does internally so I don't think I have any way to debug this further? FWIW, my app is super simple ATM:
module xyz
go 1.17
require (
github.com/go-chi/chi/v5 v5.0.7
go.etcd.io/bbolt v1.3.6
google.golang.org/appengine/v2 v2.0.1
)
require (
github.com/golang/protobuf v1.3.1 // indirect
golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d // indirect
)
And:
runtime: go116
main: ./cmd/server
The solution was to go to container registry (maybe artifact registry soon) in the cloud console and delete all the containers there. The issue was quite likely just one of those images (maybe the build cache one) but my app is not released so I could just delete all of them.
I resolve it using --no-cache option, but its not perfect because cache is not enabled.
$ gcloud app deploy app.yaml --no-cache

Appengine Go1.11 beta deployment failure

I am trying my hands on Go, and started with the go1.11 beta.
The first Hello world example worked fine and I was able to view it via the browser.
In my second attempt, I created multiple .go files (main.go, datastore.go).
I am able to run it locally and it works fine.
However when I attempt to deploy, I get the following error (deployment in first example worked just fine):
gcloud app deploy
...
File upload done.
Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build 67d67177-13cd-4e80-980a-ea36a0760678 status: FAILURE.
Build error details: go build: cannot use -o with multiple packages
On the server, the build logs show:
Step #1 - "builder": building app with command '[go build -o /tmp/staging735225713/usr/local/bin/start ./...]', env '[PATH=/go/bin:/usr/local/go/bin:/builder/google-cloud-sdk/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOSTNAME=d0f271c7f5b8 HOME=/builder/home BUILDER_OUTPUT=/builder/outputs DEBIAN_FRONTEND=noninteractive GOROOT=/usr/local/go/ GOPATH=/go GOPATH=/tmp/staging735225713/srv/gopath]': err=exit status 1, out=go build: cannot use -o with multiple packages
Finished Step #1 - "builder"
ERROR
ERROR: build step 1 "gcr.io/gae-runtimes/go111_app_builder:go111_20181212_RC00" failed: exit status 1
What am I doing wrong?
UPDATE:
Tried various things, including subfolder or a 'vendor' folder as suggested, but no avail.
Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build 79c39e82-3185-4ae1-a7ff-6afa1be448e7 status: FAILURE.
Build error details: srv/proto/myfile.pb.go:8:2: cannot find package "github.com/golang/protobuf/proto" in any of:
/usr/local/go/src/github.com/golang/protobuf/proto (from $GOROOT)
/tmp/staging770905501/srv/gopath/src/github.com/golang/protobuf/proto (from $GOPATH)

conversation+discovery java code is working

I am trying to run the sample java watson conversation with discovery service in my IBM account.
I have created the java app and added the service details in environment variables and tried to deploy the code but getting below error .
please let me know what is the cause for this issue.
Preparing to start the job...
Cloning the 'master' branch from repo 'https://git.eu-gb.bluemix.net/anil.narayanaswamy002/tnchatbot.git'
Repository successfully cloned
Download https://plugins.gradle.org/m2/com/moowork/gradle/gradle-node-plugin/0.12/gradle-node-plugin-0.12.pom
Download https://plugins.gradle.org/m2/com/moowork/gradle/gradle-gulp-plugin/0.12/gradle-gulp-plugin-0.12.pom
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'conversation-with-discovery'.
Could not resolve all dependencies for configuration ':classpath'.
Could not resolve org.codehaus.groovy:groovy-backports-compat23:2.3.5.
Required by:
com.ibm.watson.wea.app:conversation-with-discovery:0.5.0-SNAPSHOT
Could not GET 'https://plugins.gradle.org/m2/org/codehaus/groovy/groovy-backports-compat23/2.3.5/groovy-backports-compat23-2.3.5.pom'.
peer not authenticated
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 8.217 secs
Finished: FAILED

AppEngine Deploy is Conflicting SHA1 sum for a file

I want to deploy an update to our app but we have an issue with gcloud command which failed to "Conflicting SHA1 sum for file". Here is the output:
➜ gcloud app deploy xxx-xxx-xxxx.yaml --project xxx-xxx-xxxx --quiet
Services to deploy:
descriptor: [/home/vzool/Workspace/xxx-xxxx-xxxxxxxxxxx/xxx-xxx-xxxx.yaml]
source: [/home/vzool/Workspace/xxx-xxxx-xxxxxxxxxxx]
target project: [xxx-xxx-xxxx]
target service: [default]
target version: [20180917t110153]
target url: [https://xxx-xxx-xxxx.appspot.com]
Beginning deployment of service [default]...
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 1 file to Google Cloud Storage ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [3] The following errors occurred while copying files to App Engine:
File https://storage.googleapis.com/staging.xxx-xxx-xxxx.appspot.com/c819d7599ceb31df8d4370eed1981defcb5034c6 failed with: Conflicting SHA1 sum for file. Expected "ddb6af3b_cf4bff57_613fb78d_208480fa_1717b3c4" but received "c819d759_9ceb31df_8d4370ee_d1981def_cb5034c6".
Details: [
[
{
"#type": "type.googleapis.com/google.rpc.ResourceInfo",
"description": "Conflicting SHA1 sum for file. Expected \"ddb6af3b_cf4bff57_613fb78d_208480fa_1717b3c4\" but received \"c819d759_9ceb31df_8d4370ee_d1981def_cb5034c6\".",
"resourceName": "https://storage.googleapis.com/staging.xxx-xxx-xxxx.appspot.com/c819d7599ceb31df8d4370eed1981defcb5034c6",
"resourceType": "file"
}
]
]
I do delete this file c819d7599ceb31df8d4370eed1981defcb5034c6 but everytime new hash will be generated, delete entire block staging.xxx-xxx-xxxx.appspot.com and I did clear Memcache but with no luck trying all these options! :(
I don't know what to do anymore with this, any suggestions may help me out?
Thanks
I think after sometime in research the issue, the app itself has a live feature which lead to update one file while you open live page.
So, that change what gcloud uploaded.
gcloud upload then verify. And if file changed after upload and before verify gcloud will through this error on your face. Ha ha ha ^_^
OP's answer seemed to indicate that a file got touched during the gcloud deploy process.
The solution for me was to:
git checkout some random branch
git checkout the branch I was actually trying to deploy again
run gcloud app deploy . --version my_version_id --project my_project_id

Google cloud sdks doesn't start preview for Docker image Mac OS

My app.yaml
runtime: custom
vm: true
api_version: 1
health_check:
enable_health_check: False
Dockerfile
# Use the official go docker image built on debian.
FROM golang:1.5.1
# Grab the source code and add it to the workspace.
ADD . /go/
# Install revel and the revel CLI.
RUN go get github.com/revel/revel
RUN go get github.com/revel/cmd/revel
# Use the revel CLI to start up our application.
ENTRYPOINT revel run 4quorum-appengine dev 8080
# Open up the port where the app is running.
EXPOSE 8080
I was working through this article
http://jbeckwith.com/2015/05/08/docker-revel-appengine/
Preview
I am trying to preview it:
gcloud preview app run app.yaml --custom-entrypoint "revel run 4quorum-appengine dev 8080"
WARNING: The `app run` command is deprecated and will soon be removed.
Please use dev_appserver.py (in the same directory as the `gcloud` command) instead.
Module [default] found in file [/Users/802619/Projects/src/4quorum_root/app.yaml]
INFO: Looking for the Dockerfile in /Users/802619/Projects/src/4quorum_root
INFO: Using Dockerfile found in /Users/802619/Projects/src/4quorum_root
INFO 2015-11-06 18:03:44,226 application_configuration.py:399] No version specified. Generated version id: 20151106t180344
INFO 2015-11-06 18:03:44,226 devappserver2.py:763] Skipping SDK update check.
INFO 2015-11-06 18:03:44,266 api_server.py:205] Starting API server at: http://localhost:62780
INFO 2015-11-06 18:03:44,272 dispatcher.py:197] Starting module "default" running at: http://localhost:8080
INFO 2015-11-06 18:03:44,277 admin_server.py:116] Starting admin server at: http://localhost:8000
ERROR 2015-11-06 18:03:44,282 instance.py:280] [Errno 2] No such file or directory
The same thing if trying dev_appserver.py
Deploy
Deploy also doesn't work. Fails because of timeout.
gcloud preview app deploy ./app.yaml
WARNING: Soon, deployments will set the deployed version to receive all traffic by
default.
To keep the current behavior (where new deployments do not receive any traffic),
use the `--no-promote` flag or run the following command:
$ gcloud config set app/promote_by_default false
To adopt the new behavior early, use the `--promote` flag or run the following
command:
$ gcloud config set app/promote_by_default true
Either passing one of the new flags or setting one of these properties will
silence this message.
You are about to deploy the following modules:
- vaulted-gift-112113/default (from [/Users/802619/Projects/src/4quorum_root/app.yaml])
Deployed URL: [https://20151106t204027-dot-vaulted-gift- 112113.appspot.com]
(add --promote if you also want to make this module available from
[https://vaulted-gift-112113.appspot.com])
Beginning deployment...
Verifying that Managed VMs are enabled and ready.
Provisioning remote build service.
Copying certificates for secure access. You may be prompted to create an SSH keypair.
Building and pushing image for module [default]
Saving [.dockerignore] to [/Users/802619/Projects/src/4quorum_root].
----------------------------- DOCKER BUILD OUTPUT ------------------------------
Step 0 : FROM golang:1.5.1
---> f6271e8f3723
Step 1 : ADD . /go/
---> 94fafc5e8a30
Removing intermediate container cfbe197f6e93
Step 2 : RUN go get github.com/revel/revel
---> Running in d7ad8c923144
---> b65877cf3049
Removing intermediate container d7ad8c923144
Step 3 : RUN go get github.com/revel/cmd/revel
---> Running in 2a9b3320ce47
---> 428defd008f3
Removing intermediate container 2a9b3320ce47
Step 4 : ENTRYPOINT revel run 4quorum-appengine dev 8080
---> Running in 8b9e38ec69ec
---> 3749ee8a6636
Removing intermediate container 8b9e38ec69ec
Step 5 : EXPOSE 8080
---> Running in a0e6c66b56c8
---> dafff62b9643
Removing intermediate container a0e6c66b56c8
Successfully built dafff62b9643
--------------------------------------------------------------------------------
Copying files to Google Cloud Storage...
Synchronizing files to [gs://staging.vaulted-gift-112113.appspot.com/].
Updating module [default]...|Deleted [https://www.googleapis.com/compute/v1/projects/vaulted-gift- 112113/zones/us-central1-f/instances/gae-builder-vm-20151106t204027].
Updating module [default]...failed.
ERROR: (gcloud.preview.app.deploy) Error Response: [4] Timed out creating VMs.
About to drop this.
Moved to heroku. Google App Engine is not ready yet.

Resources