Fix GCP Cloud Run Run Revision Errors
When working with GCP Cloud Run, you may encounter a configuration error that prevents your deployment from working. This guide explains the most common mistake with run revision and shows the exact fix.
A Common Mistake
Deploying a new revision but not keeping the previous revision, making rollback impossible if the new revision has issues.
The incorrect command:
gcloud run deploy my-service --image=gcr.io/my-project/my-image:v2
Error output:
Deployed new revision.
The previous revision is automatically deleted because --no-traffic or revision retention is not configured. When v2 has a bug (500 errors for all requests), there is no previous revision to roll back to. The service is broken with no recovery path.
The Correct Approach
The right way to configure run revision in GCP Cloud Run:
gcloud run deploy my-service --image=gcr.io/my-project/my-image:v2 && gcloud run services describe my-service --region=us-central1 --format='value(status.traffic)'
Successful result:
Deployed.
Previous revision (my-service-00001-war) is retained. To roll back:
gcloud run services update-traffic my-service --to-revisions=my-service-00001-war=100
Rollback is immediate with zero downtime.
How to Prevent This
Set --no-traffic to deploy without serving traffic. Keep at least 1-2 old revisions. Use gcloud run revisions list to see all revisions. Set revision retention with --revision-suffix. Use traffic splitting for gradual rollouts. Always keep the previous revision until the new one is verified.
FAQ
Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro. Secure your cloud with DodaTech.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro