Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Cloud Run deployment fails but container works locally on 8080, also no console logs

Hi Folks,

My Cloud Run service is failing with following error. 

Revision 'openfga-00016-dbg' is not ready and cannot serve traffic. The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable within the allocated timeout. This can happen when the container port is misconfigured or if the timeout is too short. The health check timeout can be extended. Logs for this revision might contain more information.

The container works locally when i run using say `docker run .. ` , it also works on my local minikube setup, but somehow in CloudRun in doesn't work.

Here's the dockerFile: https://github.com/openfga/openfga/blob/main/Dockerfile

I am having difficulty debugging because there are no console logs on StackDriver. 

Any pointers would be really helpful 

 

 

 
0 1 1,172
1 REPLY 1

Hi @luke_skywalker2,

Welcome to Google Cloud Community!

I can see that the error indicates that the Cloud Run service failed because the container did not listen on the required port (PORT=8080) or failed to respond within the timeout period. Here's how may resolve it:

  1. Port: Ensure your app reads the PORT environment variable instead of hardcoding a port.
  2. Timeout: If your app takes time to start, increase the timeout using:
    gcloud run deploy <service-name> --timeout=600s

  3. Logs: Make sure your app logs to stdout and stderr. Check Cloud Run logs in the console or use:
    gcloud run services describe <service-name> --region=<region>

  4. Test Locally: Run your container locally with:
    docker run -e PORT=8080 -p 8080:8080 <image>

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.