I can not deploy my golang application (with echo framework) on App Engine.
I have some kind of error like:
...
Step #0: main.go:4:2: cannot find package "FBackend/router" in any of:
Step #0: /usr/local/go/src/FBackend/router (from $GOROOT)
Step #0: /workspace/_gopath/src/FBackend/router (from $GOPATH)
Finished
Step #0 ERROR
ERROR: build step 0 "..." failed: exit status 1
In project I have file three like this:
FBackend
...
|___router
| |____router.go
...
|
|___main.go
On localhost all works fine
Judging from the error message, you should set one of the paths to the "src" folder.
They should be able to find "FBackend/router" in "/usr/local/go/src/" since it's there.
I can understand how it can't find "FBackend/router" in "/usr/local/go/src/FBackend/router" cause you probably don't have "/usr/local/go/src/FBackend/router/FBackend/router" setup.
Related
I keep running into this error when trying to deploy a very simple website to App Engine (this code without the Dockerfile, as specified in this tutorial).
I am running on macOS Monterey 12.2.1, go 1.18, fresh install of the Google Cloud SDK. I'm not using any external packages either.
Every time that I try to deploy, I get the Step #0: exec: "gcc": executable file not found in $PATH error. Here's a larger snippet:
Step #0: go: finding golang.org/x/tools v0.0.0-20200904185747-39188db58858
Step #0: go: finding google.golang.org/grpc v1.31.1
Step #0: go: finding golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f
Step #0: # net
Step #0: exec: "gcc": executable file not found in $PATH
Finished Step #0
ERROR
ERROR: build step 0 "gcr.io/gcp-runtimes/go1-builder#sha256:408a098788ef4cdeec452821946b986ef82ce5ebceecbdf748ffecf329765bce" failed: step exited with non-zero status: 2
Any clues what is going wrong? I read some similar posts that it could be an error with the PATH, but I could not get anything to work for myself. Here is my path:
/usr/bin:/usr/local/go/bin:/Users/temporaryadmin/go/bin:/Users/temporaryadmin/google-cloud-sdk/bin:/Users/temporaryadmin/.pyenv/shims:/Users/temporaryadmin/.pyenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/bin/python3:/usr/local/go/bin
Really struggling to understand what I can do to fix this so I can start uploading to App Engine. Thanks a lot!
I am deploying a trivial App Engine Standard Environment app. (Literally the shortest possible, a Python 3 "hello world".) I am using Macbook with zshell.
If I redirect standard error to file, I get an error (below) every time.
gcloud app deploy -q 2>>err.log
If I omit the redirection, it succeeds every time.
There is no difference between using > or >>. Redirecting with a pipe, e.g. to grep, does not cause the problem.
So this is a "solution" (by sending output through a passthrough grep) that does what I need and does not trigger the problem, but this is very roundabout.
gcloud app deploy -q 2>&1 >/dev/null |egrep "." >> err.txt
Note that I use -q, so waiting for my Y for approval is not the issue.
The error is this. (Identifiers were anonymized.)
..................failed.
ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build BUILD_ID status: FAILURE
Build error details: Failed to download at least one file. Cannot continue.
Full build logs: https://console.cloud.google.com/cloud-build/builds/BUILD_ID?project=PROJECT_ID
Looking at the logs, I see this.
starting build "BUILD_ID"
FETCHSOURCE
BUILD
Starting Step #0 - "fetcher"
Step #0 - "fetcher": Already have image (with digest): gcr.io/cloud-builders/gcs-fetcher
Step #0 - "fetcher": Fetching manifest gs://staging.joshua-playground.appspot.com/ae/BUILD_ID/manifest.json.
Step #0 - "fetcher": Processing 728 files.
Step #0 - "fetcher": Failed to fetch gs://staging.my-project.appspot.com/BUILD_ID, will no longer retry: fetching "gs://staging.my-project.appspot.com/BUILD_ID" with timeout 1h0m0s to temp file "/workspace/.download/staging.joshua-playground.appspot.com-BUILD_ID": err SHA mismatch, got "SHA_VALUE", want "SHA_VALUE"
Step #0 - "fetcher": Failed to download at least one file. Cannot continue.
Finished Step #0 - "fetcher"
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/gcs-fetcher" failed: step exited with non-zero status: 1
Google has confirmed this issue. Please track it here.
I have a Python 3 project which I am hosting on Google AppEngine Standard. Until a couple of days ago I was able to deploy normally (right since I did the initial setup in July 2019) until a couple of days ago. Now I get the following response:
starting build "abc"
FETCHSOURCE
BUILD
Starting Step #0 - "fetcher"
Step #0 - "fetcher": Already have image (with digest): gcr.io/cloud-builders/gcs-fetcher
Step #0 - "fetcher": Fetching manifest gs://staging.my-project.appspot.com/ae/xxx/manifest.json.
Step #0 - "fetcher": Processing 312 files.
Step #0 - "fetcher": Failed to fetch gs://staging.my-project.appspot.com/xxx, will no longer retry: fetching "gs://staging.my-project.appspot.com/xxx" with timeout 1h0m0s to temp file "/workspace/.download/staging.my-project.appspot.com-xxx": source-context.json SHA mismatch, got "xxx", want "yyy"
Step #0 - "fetcher": Failed to download at least one file. Cannot continue.
Finished Step #0 - "fetcher"
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/gcs-fetcher" failed: step exited with non-zero status: 1
Any idea why this would be happening and how to fix it?
P.S. I use the following command for deployment:
gcloud --project my-project app deploy app.yaml
After conversation with Google engineers (https://issuetracker.google.com/issues/154588981?pli=1) the following worked:
Remove the source-context.json file
Delete the bucket where the deployment files are, e.g. gs://staging.my-project.appspot.com
Deploy again
If you need the source-context.json file, you can follow these steps: https://www.google.com/url?q=https://cloud.google.com/debugger/docs/source-context&sa=D&usg=AFQjCNHMB7Dm_jISwG2AnpokQ7XN5GmLAw
This is what I did and it worked for me:
1.
Go to the link that in the error description:
2.
You'll see there some lines for staging fail, copy the name of the file in the first line:
3.
Go to the Google storage here and enter to a bucket with name that starts with "staging.***"
And inside that bucket I search for the string I copy in step 2:
4.
Deleted that file, and retry that steps for every line you'll see in the error details link (in my example there are 4 rows).
5.
Deploy again!
I had a similar problem after I changed a local file during a gcloud app deploy with a long upload (2200 files, because of a wrong .gcloudignore).
I fixed it by deleting the changed file in the cloud storage browser, and deploying again with gcloud app deploy.
For anyone using a NextJS project the solution may be to delete the .next folder and rebuild your project. It seems the some of the cache files from next can become out of sync.
From the root of your project:
rm -rf .next && next build
then redeploy as usual
I'm having an issue where an App Engine project will no longer build remotely (via gcloud app deploy)
This has started out of the blue, with no code changes at this end. Not sure if relevant, but it's a go 1.9 project deploying to the App Engine Flex environment.
I'm not sure how to test this in the same environment as the build, since the error is coming from Google's Container Registry
Here is the log from the Container Registry console
starting build "73f85b4d-7370-41bd-bbb2-bcf42fc38873"
FETCHSOURCE
Fetching storage object: gs://staging.[project].appspot.com/us.gcr.io/[project]/appengine/default.1ed3c690ead06f27aa651a30fab342611:latest#1531698266413753
Copying gs://staging.[project].appspot.com/us.gcr.io/[project]/appengine/default.1ed3c690ead49f731806f27aa630fab342611:latest#1531698266413753...
Operation completed over 1 objects/1.7 MiB.
BUILD
Starting Step #0
Step #0: Pulling image: gcr.io/gcp-runtimes/go1-builder#sha256:c62ac3fbec31ddec70601d6c5b44d07063bcff6a823bdcf5e0bbaa9d3799d1db
Step #0: sha256:c62ac3fbec31ddec70601d6c5b44d07063bcff6a823bdcf5e0bbaa9d3799d1db: Pulling from gcp-runtimes/go1-builder
Step #0: Digest: sha256:c62ac3fbec31ddec70601d6c5b44d07063bcff6a823bdcf5e0bbaa9d3799d1db
Step #0: Status: Downloaded newer image for gcr.io/gcp-runtimes/go1-builder#sha256:c62ac3fbec31ddec70601d6c5b44d07063bcff6a823bdcf5e0bbaa9d3799d1db
Step #0: exec: "gcc": executable file not found in $PATH Finished
Step #0 ERROR ERROR: build step 0 "gcr.io/gcp-runtimes/go1-builder#sha256:c62ac3fbec31ddec70601d6c5b44d07063bcff6a823bdcf5e0bbaa9d3799d1db" failed: exit status 2
It looks like you are using container gcr.io/gcp-runtimes/go1-builder as your build step. Looking at the source in GitHub, I see that there have been no updates since ~late June. I see in the Dockerfile that the base image in the FROM directive is gcr.io/google-appengine/debian9:latest, and a look at that image reveals no gcc installed. I see no step in the Dockerfile installing gcc, and looking at your build step image confirms that it isn't there:
~$ docker run --rm -t -i --entrypoint /bin/bash gcr.io/gcp-runtimes/go1-builder#sha256:c62ac3fbec31ddec70601d6c5b44d07063bcff6a823bdcf5e0bbaa9d3799d1db -- which gcc
Unable to find image 'gcr.io/gcp-runtimes/go1-builder#sha256:c62ac3fbec31ddec70601d6c5b44d07063bcff6a823bdcf5e0bbaa9d3799d1db' locally
sha256:c62ac3fbec31ddec70601d6c5b44d07063bcff6a823bdcf5e0bbaa9d3799d1db: Pulling from gcp-runtimes/go1-builder
e154cec6816f: Pull complete
<pulls elided>
Digest: sha256:c62ac3fbec31ddec70601d6c5b44d07063bcff6a823bdcf5e0bbaa9d3799d1db
Status: Downloaded newer image for gcr.io/gcp-runtimes/go1-builder#sha256:c62ac3fbec31ddec70601d6c5b44d07063bcff6a823bdcf5e0bbaa9d3799d1db
~$
Perhaps an earlier version of the base debian9 image had it installed, you could dig into history to look. But it looks like there is no recent change to the go1-builder image to remove gcc.
If you need gcc, you can always separate building your app from deploying it. Build with your own cloudbuild.yaml via gcloud container builds submit and then deploy the built container using gcloud app deploy --image-url=... With full control over the build, you can always based on the go-builder image and install additional tooling you need like gcc on top of that before using Docker to build your final app container.
Trying to deploy my GO application with Cloud SQL using gcloud app deploy but build is failing every time with package not found error. Not sure where it is picking the GOPATH from. Is it possible to change the GOPATH in google cloud engine.
Step #0: main.go:9:2: cannot find package "github.com/gin-gonic/gin"
in any of: Step #0: /usr/local/go/src/github.com/gin-gonic/gin (from
$GOROOT) Step #0: /workspace/_gopath/src/github.com/gin-gonic/gin
(from $GOPATH) Step #0: main.go:10:2: cannot find package
"github.com/go-sql-driver/mysql" in any of: Step #0:
/usr/local/go/src/github.com/go-sql-driver/mysql (from $GOROOT) Step
#0: /workspace/_gopath/src/github.com/go-sql-driver/mysql (from $GOPATH) Step #0: main.go:8:2: cannot find package
"google.golang.org/appengine" in any of: Step #0:
/usr/local/go/src/google.golang.org/appengine (from $GOROOT) Step #0:
/workspace/_gopath/src/google.golang.org/appengine (from $GOPATH)
I have import statements to include the above libraries. My local GOPATH is set to /Users/amar.jain/go/ and it is trying to use /workplace/_gopath/
I'm also using the GO App Engine SDK.
As mentioned in here, the following line should be deleted from the app.yaml file when using Flexible environment:
api_version: go1
Compare an example of an app.yaml file when in Flexible and Standard.
These are the options available when configuring the Flexible environment.
Are you using the app engine standard environment?
The app engine standard environment is picky about GOPATH, it does try to upload all files required but it often helps to vendor the dependancies and make sure the app.yaml is at the top level.
https://cloud.google.com/appengine/docs/standard/go/building-app/creating-your-application#structuring_your_application_project
Ive had problems with the standard environment when using the standard go /cmd /pkg structure for example.