oystersauce
oystersauce

Reputation: 661

Nodejs app on Google Cloud App Engine not starting

Good day,

my very basic Nodejs app is deployed on a Google Cloud App Engine instance is not starting. The app works locally, deployment with app deploy runs without error - and on the app instance the app runs successfully when started manually through Cloud shell (with >npm start). However, as soon as the Cloud Shell is closed my app is dead. What am I missing? How do I start-up the app to run permanently?

The app consists of

app.yaml:

runtime: nodejs8
handlers:
- url: /
  script: auto

package.json:

{
  "name": "blexplorer",
  "version": "1.0.0",
  "description": "",
  "main": "bot4.js",
  "scripts": {
    "start": "node bot4.js"
  },
  "author": "oystersauce",
  "license": "ISC",
  "dependencies": {
    "discord.js": "^11.4.2",
    "request": "^2.88.0"
  }
}

Again, the app is running fine when started through the Cloud Shell but no longer, as soon as the Cloud Shell is closed. Also, it's a super simple discord-bot - hence there is no front-end whatsoever.

EDIT: this is how I thought I started the app manually - but what I did here is starting the app within the cloud shell and not on the app instance: enter image description here

here is how I deploy the app: enter image description here

Upvotes: 3

Views: 1727

Answers (1)

Dan Cornilescu
Dan Cornilescu

Reputation: 39814

From GAE perspective the cloud shell is simply a shell on a "local" development machine which just happens to be hosted in the cloud. The instance running the cloud shell has no special relationship with GAE whatsoever.

What you're doing when running npm start is not actually starting the GAE instance, you're just starting a "local" execution of your service, just like when you'd be doing the same on your local machine.

With your configuration GAE should start your app automatically as soon a request for it is received. On an app with a frontend just clicking on the link you circled in the snapshot would get you on it. Since yours doesn't have a frontend it would probably be just started, but you'd have to rely on the dashboard info and/or your app's logs to confirm it is running.

Upvotes: 5

Related Questions