3
votes

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

  • bot4.js file,
  • npm dependencies
  • app.yaml
  • package.json

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

1
Something doesn't add up - cloud shell is normally not related to GAE, whatever GAE-related thing you do in cloud shell you should be able to do on your local machine as well. And starting a GAE app instance is not one of those things. So how exactly do you start your app "manually"?Dan Cornilescu
@DanCornilescu thanks for your comment. I added a pic that shows it all. as I understood it "true-study-159312" is the name of my app instance. but it isn't? what am I starting then?oystersauce
it just dawns on me that I am starting the app really in the cloud shell with files from my cloud storage - that is not the app. so it's no wonder the app is not running when I close the shell. Updating the question again.oystersauce
Yup, you got it exactly right.Dan Cornilescu

1 Answers

5
votes

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.