2
votes

I've had a really difficult time getting anything to deploy properly with Google Cloud Platform using App Engine.

app.yaml

runtime: nodejs8
#env: flex
beta_settings:
  cloud_sql_instances: my-project:us-central1:my-db

I am using the following cmd to deploy:

gcloud app deploy --project=my-project

I would prefer to use the standard environment versus the flexible environment, so I have commented out env:flex. Upon deploying, I will get an error that nodejs is not a valid runtime, so I changed it to nodejs8 from just nodejs. I can successfully deploy to a flexible environment with:

env: flex
runtime: nodejs

But I cannot deploy using:

runtime: nodejs8

Error is:

Beginning deployment of service [default]...
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 0 files to Google Cloud Storage                ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [13] Error importing container 
images.
2

2 Answers

4
votes

The default Node.js version in App Engine Flex is taken from the latest LTS(long term support) release. If you want to specify a version, you can do it in your application’s package.json file by using the engines field.

{
  "engines": {
    "node": "8.x"
  }
}

In this link, you can find more in depth explanation on how to change the Node.js version in the App Engine Flex Environment

The Node.js Runtime

2
votes

The standard and flexible environments are significantly different from each-other, usually it's unlikely the exact same code is arbitrarily deployable on one or the other, changes other than the env: flex are required.

It's true, node.js appears to be, indeed, the language with the least amount of such differences, but they're still there. At least so far (the standard env node.js offering is fairly new). Other languages have massive amounts of differences, for example just peek at the python App Engine Flexible Environment for Users of App Engine Standard Environment guide

For node.js the runtime is only one of such differences.

From the standard env app.yaml Configuration File:

For Node.js, the app.yaml is required to include only the runtime: nodejs8 entry

From the flexible env app.yaml Configuration File:

runtime: nodejs

This setting is required. It is the name of the App Engine language runtime used by this application. To specify Node.js, use nodejs.

Maybe of interest: How to tell if a Google App Engine documentation page applies to the standard or the flexible environment