0

I've tried the hello world example with nodejs and php and both the standard environments work fine. But both examples using the flexible give the same error when I use 'gcloud app deploy': ERROR: gcloud crashed (TypeError): '>' not supported between instances of 'NoneType' and 'int'

Works: https://cloud.google.com/nodejs/getting-started/hello-world https://cloud.google.com/appengine/docs/standard/php7/quickstart

Fails: https://cloud.google.com/appengine/docs/flexible/nodejs/quickstart https://cloud.google.com/appengine/docs/flexible/php/quickstart

I've tried deleting the project and starting from scratch (and made sure billing was enabled). gcloud info is displaying the correct gmail account and project is set.

What am I missing?

app.yaml

runtime: nodejs
env: flex
manual_scaling:
  instances: 1
resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 10

app.js

'use strict';

// [START gae_flex_quickstart]
const express = require('express');

const app = express();

app.get('/', (req, res) => {
  res
    .status(200)
    .send('Hello, world!')
    .end();
});

// Start the server
const PORT = process.env.PORT || 8081;
app.listen(PORT, () => {
  console.log(`App listening on port ${PORT}`);
  console.log('Press Ctrl+C to quit.');
});
// [END gae_flex_quickstart]

module.exports = app;

package.json

{
  "name": "appengine-hello-world",
  "description": "Simple Hello World Node.js sample for Google App Engine Flexible Environment.",
  "version": "0.0.1",
  "private": true,
  "license": "Apache-2.0",
  "author": "Google Inc.",
  "repository": {
    "type": "git",
    "url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
  },
  "engines": {
    "node": ">=8.0.0"
  },
  "scripts": {
    "start": "node app.js",
    "test": "mocha --exit test/*.test.js"
  },
  "dependencies": {
    "express": "^4.16.3"
  },
  "devDependencies": {
    "mocha": "^6.2.0",
    "supertest": "^4.0.2"
  }
}
  • I've followed both guides *([**Node.js**](https://cloud.google.com/appengine/docs/flexible/nodejs/quickstart) and [**PHP**](https://cloud.google.com/appengine/docs/flexible/php/quickstart))* for **App Engine flexible** environment and was able to deploy the apps successfully. Since the **error** mentions a comparison operator '>' between some instances of different types, please provide the code snippets of the apps you tried to deploy. – Deniss T. Oct 17 '19 at 10:56
  • I did't make any changes to the code that came from the git clone `git clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples` And then went into nodejs-docs-samples/appengine/hello-world/flexible. I'm thinking there's a setting in the projects admin console that isn't allowing the flexible environment instance to initiate (complete guess). – Terry King Oct 17 '19 at 11:05
  • As the error message states "ERROR: gcloud crashed (TypeError): '>' not supported between instances of 'NoneType' and 'int'", I don't think it is related to the settings in your Console. Please edit your answer providing the code snippets of your app. – Deniss T. Oct 17 '19 at 15:23
  • I've added the code to the original question. – Terry King Oct 18 '19 at 09:42
  • The app.yaml file shared is missing both the `runtime: nodejs` and the `env: flex` fields. Add them at the beginning of the app.yaml file. The app.js files also shows a discrepancy on this line of code: `const PORT = process.env.PORT || 8081;` with respect of what I see on [github](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/899f72ac382934875eaebd8a4ef2c117f14ff729/appengine/hello-world/flexible/app.js#L31). This will make you to use the 8081 port to display the app when testing locally. I ran both Quickstarts on the Cloud Shell on GCP, and ran into no problems. – Daniel Ocando Oct 21 '19 at 13:22
  • How are you deploying both apps on your local computer or on GCP's Cloud Shell? – Daniel Ocando Oct 21 '19 at 13:23
  • Sorry for the delay, been on holiday. Thanks for confirming you've tried quickstarts and they work. I did have runtime and env set, just forgot to paste that into the original message (now corrected). The only thing I did change was using port 8081 for local testing as 8080 clashed with something else I was running. But these are errors I get deploying to the cloud shell. – Terry King Oct 29 '19 at 10:37

0 Answers0