`gcloud run deploy` raises "Revision <revision_name> is not ready and cannot serve traffic."

Viewed 4695

Command

gcloud run deploy api --region=$REGION --image=$IMAGE

Logs

Deploying container to Cloud Run service [api] in project [[MASKED]] region [[MASKED]]
Deploying...
Creating Revision...........interrupted
Deployment failed
ERROR: (gcloud.run.deploy) Revision [[MASKED]] is not ready and cannot serve traffic.

I've tried to search Google Cloud documentation, but it does not mention such problem.

How to solve the "Revision is not ready and cannot serve traffic."?

3 Answers

Try to wait a few minutes and then just re-launch the procedure. The good old "let's retry without changing anything" worked for me! :)

EDIT: I talked with a Cloud Architect who works with me and he told me that this is the actual solution, because if you retry too quickly to restart the deploy, GCP may still have some pending operations from the previous one!

I faced this problem as well. In my case I checked "Cloud Run" section from hamburger menu of google cloud console. The "Logs" section should give you more idea about what went wrong. I was missing a python library, and adding correct python dependency in my requirements.txt solved the issue for me. Somehow my local testing went well without this issue. I hope this helps. :)

I faced with this problem, my problem is that my docker image is missing required dependency package at build stage, my Dockerfile missed some steps to copy required files for preparing to install package.

To find you problem if cloud build logs was not make sense for you, I think you should:

  • From gcloud console, go to service "Container Registry" > Images
  • Select your repository name
  • From the image version (maybe latest) that you want to check > more actions > show pull command > then copy that command ex: docker pull gcr.io/..
  • From gcloud console header > select activate cloud shell
  • At cloud shell terminal, pull docker images of your latest build by running "pull command" that you copied before.
  • Start your container from this image to see what exactly happens with your run revision
Related