URGENT: Nginx 502 while deploying react app?

45 views
Skip to first unread message

Mohammed Hayat

unread,
Feb 17, 2020, 1:23:41 PM2/17/20
to Google App Engine
Hello, 

I am trying to deploy a react app to GAE flex and I've made sure that the app is listening to port 8080 but for some reason everything I do results in a page that says `502 Bad Gateway nginx`, this is what my app.yaml looks like: 

# runtime to spin up frontend
runtime: nodejs

# type of App Engine environment
env: flex

# command to begin frontend server
entrypoint: yarn start

# name of the service (default because this is where we want traffic to go)
service: default

# computing resources (went with defaults)

# scaling configuration
automatic_scaling:
  min_num_instances: 1
  max_num_instances: 2
  cool_down_period_sec: 140
  cpu_utilization:
    target_utilization: 0.6

# handlers for routing
handlers:
  - url: /
    static_files: build/index.html
    upload: build/index.html

  - url: /(.*)
    static_files: build/\1
    upload: build/(.*)
 
I have edited the start script to include 'PORT=8080', but that does not help.

noverlyjoseph

unread,
Feb 18, 2020, 8:28:00 AM2/18/20
to Google App Engine
Since you're using managed nodejs runtime, you can remove the `entrypoint` from your app.yaml
App Engine will automatically launch the application for you.
You're getting the 502 error because App Engine is trying to find an entrypoint since it is define in the .yaml but cannot launch it.
Reply all
Reply to author
Forward
0 new messages