Error when deploying to Google App Engine - google-app-engine

I've been deploying different versions of my app to google cloud over the last few days. After successfully uploading a few large files, all of a sudden I receive this error:
ERROR: (gcloud.app.deploy) Cannot upload file [/Users/tgb29/Desktop/shaforms2/python-docs-samples/appengine/flexible/storage/shaforms.bin], which has size [803047362] (greater than maximum allowed size of [33554432]). Please delete the file or add to the skip_files entry in your application .yaml file and try again.
I'm not sure what changed in one deployment.

I think this problem is releted to Google App Engine Standard java 8.
When I used java11, problem disappeared.
This app.yaml works for me:
runtime: java11
env: standard
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 0.5
disk_size_gb: 10
launch by:
gcloud app deploy

App Engine has a limit regarding the number of files and the size they can have when deploying a new version, quoting the documentation:
An application is limited to
10,000 uploaded files per version. Each file is limited to a maximum
size of 32 megabytes. Additionally, if the total size of all files for
all versions exceeds the initial free 1 gigabyte, then there will be a
$ 0.026 per GB per month charge.
Since your file shaforms.bin seems to be above this limit, you cannot deploy the version as long as it contains this file.
The solution would be to deploy your application without this file, for example, in the Python Standard runtime you can add the skip_files flag to ignore certain files, in your case you could do it by adding the following lines to the app.yaml configuration file:
skip_files:
- /Users/tgb29/Desktop/shaforms2/python-docs-samples/appengine/flexible/storage/shaforms.bin
As well, if you need this file to be served from your application, the best would be to upload it to Google Cloud Storage and serve it from there, by using the Client Libraries.

I was facing the same issue.
Updating my Gcloud CLI version to 406.0.0 Solved the error.
I was earlier having version 155.0.0 when I had faced this issue.
Some additional notes - Using 155.0.0 with Flex App Engine did not give the error. The error had come only with standard App Engine and was fixed by updating the GCloud version to 406.0.0

Related

GCP App Engine - How to serve newest files

I'm using GCP App Engine with auto scaling.
If I deploy a new version of the app code (Python 3 Flask app) with a simple change for control and test purposes, lets say I add a comment to one of the .js files I am not seeing that change to the file in the browser after it has been deployed.
I have 100% of traffic being served by the new version of the app. When I look at the source code for the version I can see the comment in there, but when I clear my browser cache and visit the page I only ever get the old version of the page (without the comment in the .js).
I have tried using the --promote and --no-cache values in the app deploy command, but no use. I have added:
default_expiration: "0d 0h 0m 0s"
To the app.yaml
I have also turned on object versioning of the storage account which app engine uses to try to ensure that only a single version of the file is available to be served - still no use.
The command I'm using to deploy is:
run: "gcloud app deploy app.yaml --quiet --promote --no-cache"
I can't understand why it should be so difficult to simply deploy a new version of the app and have the app engine serve the latest files; I must be doing something wrong but cannot see what.
Would appreciate any pointers.
The files are cached (even if for a short while and sometimes it takes time to clear it).
The trick is to make the urls (for the static files) unique for each deployment. This way, the browser is loading a 'distinct' url after each deployment. For example, you could append the environment variable, CURRENT_VERSION_ID to the url for all static elements. This means having something like (assuming Python/Jinja2)
src="/static/js/my_js_file.js?{{CURRENT_VERSION_ID}}"
os.environ['CURRENT_VERSION_ID'] changes for each deployment. There's a possibility this attribute is not available in newer runtimes. If so, just dump the environment variables and look for an attribute that is always present but the value changes (e.g. GAE_INSTANCE).
You could also just generate a random number each time your App is deployed and use that instead i.e.
src="/static/js/my_js_file.js?{{RANDOM_NUMBER}}"

How to reduce ktor App file size for Google App Engine Deployment

I am trying to deploy app.yaml file to my Google App Engine project which I built using Ktor + gradle and I get this error,
ERROR: (gcloud.app.deploy) Cannot upload file [the file], which has size [43355410] (greater than maximum allowed size of [33554432]). Please delete the file or add to the skip_files entry in your application .yaml file and try again.
I am not using any images or videos in my projects, its pure Kotlin code but the project is 49.2MB. It seems like all the space is being occupied by the libraries I use. All of these libraries are essential to my project, how do I reduce the file size for Google App Engine since I cannot add the app.yaml file now. Strangely the project does upload when I use 'gradle appengineDeploy' command but not when I use 'gcloud app deploy app.yaml'
To resolve this issue you can set runtime in the app.yml file to java11 (I've tested it). The quote from the relevant answer:
I think this problem is related to Google App Engine Standard java 8.
When I used java11, the problem disappeared.

Error deploying GAE Flex with gcloud app deploy

All of a sudden having issues with deploying to GCP using gcloud app deploy.
Created a brand new project and tried to upload a sample hello-world app from GCP, but still get the following error:
ERROR: (gcloud.app.deploy) Error Response: [3] Docker image us.gcr.io/gcp-test-8710371/appengine/default.20181106t173450:latest was either not found, or is not in Docker V2 format. Please visit https://cloud.google.com/container-registry/docs/ui
app.yaml:
runtime: nodejs
env: flex
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 0.5
disk_size_gb: 10
SDK: Google Cloud SDK 224.0.0
I've checked the container registry, and nothing is created there.
Also, tried enabling/disabling APIs like in this post, but with no result.
An example Python app uploads fine with no problems.
Appears it was an issue on GCP's side. The error is no longer occuring, so I assume it was resolved.
There was an issue affecting the Flex deployments. The issue was fixed on 07/11 at aproximately 00:40 UTC. As #isharko pointed out, Flex deployments should be working normally now.
There's also a public issue on GCP's issue tracker about this. If new relevant information surfaces, it'll likely be posted there.

gcloud app deploy failed: Docker image not found or not in V2 format [duplicate]

All of a sudden having issues with deploying to GCP using gcloud app deploy.
Created a brand new project and tried to upload a sample hello-world app from GCP, but still get the following error:
ERROR: (gcloud.app.deploy) Error Response: [3] Docker image us.gcr.io/gcp-test-8710371/appengine/default.20181106t173450:latest was either not found, or is not in Docker V2 format. Please visit https://cloud.google.com/container-registry/docs/ui
app.yaml:
runtime: nodejs
env: flex
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 0.5
disk_size_gb: 10
SDK: Google Cloud SDK 224.0.0
I've checked the container registry, and nothing is created there.
Also, tried enabling/disabling APIs like in this post, but with no result.
An example Python app uploads fine with no problems.
Appears it was an issue on GCP's side. The error is no longer occuring, so I assume it was resolved.
There was an issue affecting the Flex deployments. The issue was fixed on 07/11 at aproximately 00:40 UTC. As #isharko pointed out, Flex deployments should be working normally now.
There's also a public issue on GCP's issue tracker about this. If new relevant information surfaces, it'll likely be posted there.

Why is appengine serving an old version of my nodejs express app on https but the latest one properly on http appspot?

I have run gcloud app deploy many times over the past 12 hours. When I run gcloud app browse my browser opens up https://mysite.appspot.com with some old version of my app from hours ago. I Can't even tell which at this point. However, if I visit http://mysite.appspot.com (wihout TLS) I get my new, expected version.
I've restarted the versions with the GCP console but have had no success in seeing my latest version at https://mysite.appspot.com. The console even says that the proper version is serving with 100% allocation, and indeed it is, over at http but not at https.
my app.yaml has only these 2 lines per the documentation
env: flex
runtime: nodejs
What am I doing wrong?

Resources