I wrote an application (NodeJS 12, Express) which installs and works locally, and would like to deploy it on gcloud's app engine.
My app.yaml:
service: staging runtime: nodejs12
handlers:
- url: /.*
secure: always
script: auto
When deploying to google cloud's app engine, I'm getting this error:
Error type: UNKNOWN
Error message: npm ERR! object.assign not accessible from es-abstract
Other projects deploy fine.
Switching the runtime in the app.yaml to nodejs14 made the issue disappear. I know this might not be a perfect solution for everyone, but if your code is fine with a different node version it might help.
Related
I am experiencing a strange issue with dependencies when deploying my application to Google App Engine (Python 2.7).
I have specified my dependencies in the requirements.txt file:
Flask==1.0.2
werkzeug>=0.14
flask-cors
twilio
httplib2
gunicorn
Jinja2
google-cloud-ndb
exponent_server_sdk
These work fine with the local development server when installed locally with pip from the requirements.txt folder.
However, when I deploy to app engine, it appears that the module exponent_server_sdk has not been installed (ImportError: No module named exponent_server_sdk).
I normally deploy by pushing to a git repository which is then deployed with Google Cloud Build ("gcr.io/cloud-builders/gcloud"). There are no errors when I deploy and other dependencies in the requirements.txt file work fine such as twilio or Jinja2.
Whilst investigating this I tried pushing directly from my development machine with gcloud app deploy. When I do this, for some strange reason, exponent_server_sdk is available and works correctly.
This behaviour seems very strange to me and I can't find any documentation of people experiencing similar errors. I wonder if anyone can give me any guidance about what might be causing this issue or places I can look to find errors (for example logs of the process of installing the requirements.txt file during deployment/instance startup).
In response to the comments:
I am running in the standard environment.
My cloudbuild.yaml looks like this:
steps:
- name: "gcr.io/cloud-builders/gcloud"
args: ["app", "deploy", "app.yaml", "dispatch.yaml", "service_1.yaml", "service_2.yaml", "service_3.yaml", "index.yaml"]
timeout: "1600s"
The .yaml file for the service in which I am experiencing the error looks like this:
runtime: python27
api_version: 1
threadsafe: true
service: notifications
libraries:
- name: ssl
version: latest
handlers:
- url: /.*
script: notifications.app
For the (1st gen) standard environment the deployment process does not use a requirements.txt file, the libraries should be installed inside your app. From Copying a third-party library:
Use pip (version 6 or later) with the -t <directory> flag to
copy the libraries into the folder you created in the previous step.
For example:
pip install -t lib/ <library_name>
Yes, if you want you can use a requirements.txt file to do the installation inside your app, but that file itself is not used by the deployment process.
Since you're not deploying directly from the environment in which you had the libraries installed you'd have to add the installation directory to the git repo as well.
I created a simple Vue.js application. Then I created a build for production using
npm run build command which creates dist folder in the project structure.
Then I use gcloud app deploy command to deploy it to Google App Engine, but then the deployment stops and gives error as:
ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: This deployment has too many files. New versions are limited to 10000 files for this app.
Can someone please tell me what is the proper way to deploy Vue.js application to Google App Engine?
Have you tried deploying your Vue.js app to Google App Engine using Cloud Build? I have had no problem deploying any Vue.js apps in this way. Try following this tutorial for complete instructions.
Basically, you would have to include the following two files in your project root directory when deploying your Vue.js app to Google App Engine via Cloud Build:
App.yaml
runtime: nodejs10
handlers:
# Serve all static files with urls ending with a file extension
- url: /(.*\..+)$
static_files: dist/\1
upload: dist/(.*\..+)$
# catch all handler to index.html
- url: /.*
static_files: dist/index.html
upload: dist/index.html
and
cloudbuild.yaml
steps:
- name: node:10.15.1
entrypoint: npm
args: ["install"]
- name: node:10.15.1
entrypoint: npm
args: ["run", "build"]
- name: "gcr.io/cloud-builders/gcloud"
args: ["app", "deploy"]
timeout: "1600s"
In the case you're not using cloud build you may just use the app.yaml above and reference the steps implied in the cloudbuild.yaml, which means:
run npm install
run npm run build
run gcloud app deploy
You have too many files in the project.
In your app.yaml file, add the skip_files tag to it so the deployment does not include unnecessary files or folder in the upload. You can also mix with regex so for example:
skip_files:
- node_modules/
- .gitignore
- src/
- public/
- babel.config.js
- ^(.*/)?\..*$
I found some Google Cloud Platform documentation that may be helpful to your issue, in this link under the deployment section it's indicated that for every deployment you only can upload 10,000 files per version and each file is limited to a maximum size of 32 megabytes. You're running into one of this two problems, I suggest to check this out on your app and try to deploy it again.
if you don't want to waste $10 on namecheap for an SSL cert and hours of your time (like me) you probably want to add the secure: always option to each handler.
- url: /.*
static_files: dist/index.html
upload: dist/index.html
secure: always
like so! That's if you're using a custom domain though.
We have a service hosted in gcloud that is not actively developed and we have not deployed for a few weeks.
On deployment we now get the error ERROR: gcloud crashed (TypeError): unorderable types: NoneType() > int() and the deployment fails.
We get the exact same results even if we run the last deployed version through CI.
This is my app.yaml
runtime: aspnetcore
env: flex
threadsafe: true
service: myapp
manual_scaling:
instances: 1
env_variables:
service_name: myapp
AWS_ACCESS_KEY_ID: {{AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: {{AWS_SECRET_ACCESS_KEY}}
AWS_REGION: eu-west-1
This is very unclear to me as it's not obvious what the deployment would need ordering. Is there something I am missing in interperating this error message?
Check if you have Python 3.5 installed on the same build agent. The gcloud SDK has a dependency of Python 2.7, also advisable to set the CLOUDSDK_PYTHON environment variable to the path of your Python 2.7 installation location.
A workaround that worked for me:
Instead of gcloud app deploy ... try gcloud beta app deploy ...
You may be prompted to install the beta components (allow this)
If adding 'beta' results in a successful deployment, try again without it.
It seems like something was corrupt and using the 'beta' deployment command un-corrupted things. Your mileage may vary.
I've been trying to deploy my website using Google App Engine. I have a domain name. I have a bucket with all my files uploaded into it, organized the way that google wants them. I even have the app.yaml file in the folder. However, every time I try to deploy the app I get this message:
Any advice?
the error represent a problem with the app.yaml file. here you can see an example of the app.yaml file for static sites-structure.
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /
static_files: index.html
upload: index.html
- url: /(.*)
static_files: \1
upload: (.*)
Also you can follow these official recommendations
*Off course, is necessary validate gcloud to use the last version updated.
gcloud components update
If you receive problems with the SSL3_GET_SERVER_CERTIFICATE please check this question because maybe is a problem with SDK but depend the OS and other variables.
Did you run gcloud init first? You need to do so first and follow instructions to create a named gcloud configuration e.g my_ga_app.
And then every time before running deploy, you need to run (only necessary if you are working on multiple apps):
gcloud config configurations activate my_ga_app
then the deploy
gcloud app deploy
if this does not work, make sure your gcloud is upto date by running
gcloud components update
I just completed a gcloud components update on my local machine and got several new errors when deploying my application. I was able to fix most of these new errors with a few minutes of troubleshooting (I understand that the gcloud preview app command is still 'preview', so I expect some changes here.)
I am now getting an error (bug?) that I can't seem to fix.
ERROR: (gcloud.preview.app.deploy) Error Response: [400]
version.automatic_scaling.min_pending_latency (nanos: 300000000),
must be in the range [0.010000s,15.000000s].
So, correct me if I'm wrong, but I'm pretty sure 300000000 nanos falls in the acceptable range as defined in the error.
These are the relevant sections of my app.yaml
module: api
runtime: php55
api_version: 1
threadsafe: true
instance_class: F2
automatic_scaling:
min_idle_instances: automatic
max_idle_instances: automatic
min_pending_latency: 300ms
max_pending_latency: 1s
I just tried the 300ms config on my app, but updating using the GAE SDK's appcfg.py - no issue, which supports your suspicion of a bug in the gcloud preview CLI. You might want to file an issue with the Google Cloud SDK Issue Tracker.
As a workaround you could either:
check this #klenwell's answer to this Q&A for the new location of
appcfg.py in the Google Cloud SDK:
With Google App Engine, why do I now get "command not found" when running the appcfg.py command on my local machine?
use the GAE SDK's appcfg.py to update your app.