TL;DR
- Configure your instance resources (CPU, Memory size, etc…) properly
- If you occur errors check Stackdriver Logging
I tried to run my docker image in Google App Engine as App Engine Flexible Environment.
Deployed my app with gcloud app deploy
and then App Engine occurred 502 error like this:
Error: Server Error
The server encountered a temporary error and could not complete your request.
Please try again in 30 seconds.
And I looked a health check failed to spin up a VM in Stackdriver Logging.
I misunderstood the error occurred in my code or Dockerfile. However, it occurs actually when creating a VM.
And I checked logs in Stackdriver Logging and finally found one of the causes that VM's disk has no space.
And rust of the causes is luck of memory size.
I changed my app.yaml and deployed again. Please see app.yaml Configuration File
From
runtime: custom
env: flex
service: my-service
health_check:
enable_health_check: False
To
runtime: custom
env: flex
service: my-service
health_check:
enable_health_check: False
resources:
cpu: 2
memory_gb: 5
disk_size_gb: 25
Eventually, It worked!
I missed the logs in Stackdriver Logging and spent my time for 2 days😭…
Keep in mind to check log!