Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging a node app on gcloud to fix 500 server error

We've got a hefty little node app and wanted to try out the google cloud deployment suite to get it online, however our deployments are always resulting in a page with a 500 server error.

Normally I'd provide more information, errors, etc, but I was hoping someone more knowledgeable could guide me in where I can hunt down that information. Nothing of note is appearing in the gcloud terminal when we gcloud preview app deploy, just a bunch of preparing and pushing and a final deployed module [default] to ... message. However, navigating to the URL gives us a 500 server error:

Error: Server Error

The server encountered an error and could not complete your request.
Please try again in 30 seconds.

Taking a peek at the response headers doesn't give any more information, so I've poked through the stackdriver/logs, but the only thing there is a bunch of /_ah/background GETs with no sign of any of our requests.

Where can we be looking to start debugging this issue? It's a node app with an node/express backend, react frontend, and webpack builder.

EDIT: Here's a screenshot of the app engine dashboard.

Our app.yaml:

runtime: nodejs
vm: true

skip_files:
  - ^(.*/)?.*/node_modules/.*$

Our package.json:

  "scripts": {
    "test": "karma start",
    "watch": "watch 'npm run test' client/",
    "clean": "rm -rf dist",
    "webpack-prod": "NODE_ENV=production webpack --progress -p",
    "server-prod": "NODE_ENV=production node ./index.js",
    "prestart": "npm run webpack-prod",
    "start": "npm run server-prod",
  },
like image 340
Caleb Jay Avatar asked May 13 '16 19:05

Caleb Jay


People also ask

Why do I keep getting error 500?

The HTTP status code 500 is a generic error response. It means that the server encountered an unexpected condition that prevented it from fulfilling the request. This error is usually returned by the server when no other error code is suitable.

Can I host Nodejs on Google cloud?

Google Cloud lets you choose the best environment to run your Node. js applications, with options for serverless, Kubernetes, VMs, or custom hardware.


1 Answers

In the future, gcloud preview app logs read will get you logs here that will show why the process is crashing (assuming that was the problem). We're working on surfacing these errors as part of the deployment.

like image 73
Justin Beckwith Avatar answered Sep 28 '22 07:09

Justin Beckwith