When trying to deploy your node app on App Engine, you might run into various blockers that can be difficult to diagnose.
Yesterday, my app was receiving 502 and 500 errors, depending on the tweak, and the official Google documentation on App Engine leave the deployment requirements to be desired.
[Here are the official docs on getting you nodejs project deployed on App Engine:
Docs say you need "at least runtime:nodejs10", but mine needed handlers specified (see below).
app.yaml isn't mentioned in the Quick Start]
The solution for me, in short, was making sure I had an app.yaml file in the project root, WITH url handlers:
# [START runtime] runtime: nodejs10 # [END runtime] # [START handlers] handlers: - url: / static_files: build/index.html upload: build/index.html - url: /(.*) static_files: build/\1 upload: build/(.*) # [END handlers]
Other things you'll want to check:
- your app.yaml file is in the root of your project
- if you're paying, make sure payment is set up
- make sure you ran
npm run build(or equivalent) before
gcloud app deploy
start.js(or equivalent), set default port to 8080
Let me know if there are other tips, or outdated information here.