Skip to main content

Overview

Rollbacks allow you to quickly revert to a previous stable version of your Worker. When issues arise in production, rollback provides a fast recovery path.

Quick Rollback

Roll back to the most recent stable deployment:
This automatically selects the last deployment that was at 100% traffic.

Rollback to Specific Version

Roll back to a specific version by ID:

With Custom Message

Interactive Rollback Process

When you run a rollback command, you’ll see:
1

Current deployment

View the currently active deployment:
2

Rollback target

The system identifies the rollback version:
3

Confirmation

Confirm the rollback:
4

Complete

Rollback completes:

Automatic Rollback Target

When no version is specified, the rollback command finds the default target:
The system:
  1. Fetches recent deployments
  2. Sorts by creation date (newest first)
  3. Skips the current deployment
  4. Finds the first deployment at 100% traffic

Rollback with Secret Changes

If secrets have changed since the target version was deployed, you’ll see an additional confirmation:

Secret Rollback Behavior

Rolling back does NOT revert secret values. The current secret values remain active even after rollback.
When secrets have changed:

Rollback Scope

What Gets Rolled Back

✅ Included in rollback:
  • Worker code
  • Compatibility settings
  • Binding configurations
  • Environment variables
❌ NOT included in rollback:
  • Secret values (current values persist)
  • Bound resources (KV data, R2 objects, D1 tables)
  • Durable Object state
  • Routes and triggers
  • Custom domains

Resource Data Persistence

Rollback only reverts Worker code and configuration. Data in KV namespaces, R2 buckets, D1 databases, and Durable Objects is NOT rolled back.
For example:
  • If your new version wrote data to KV, that data remains after rollback
  • If your new version created D1 tables, those tables persist
  • Durable Object instances maintain their state

Legacy Rollback (Deployments)

For non-versioned Workers, use the legacy rollback command:

Legacy Rollback Process

The legacy system works with deployments instead of versions:

Non-Interactive Rollback

Skip confirmations in CI/CD:
The --yes flag:
  • Accepts all confirmations automatically
  • Useful for automated deployments
  • Still validates the rollback target

Rollback Annotations

Rollbacks create a new deployment with special annotations:
This creates an audit trail showing:
  • The deployment was a rollback
  • Which version was rolled back from
  • Why the rollback occurred

Rollback Best Practices

  1. Monitor Deployments - Watch metrics to detect issues early
  2. Keep Stable Versions - Maintain known-good versions for rollback
  3. Document Rollbacks - Use --message to explain why
  4. Test After Rollback - Verify the rollback resolved the issue
  5. Plan Forward - Fix issues and deploy forward, don’t stay on old versions

Rollback vs. Deploy Previous Version

Two ways to revert:

Option 1: Rollback Command

  • ✅ Automatic target selection
  • ✅ Built-in confirmations
  • ✅ Rollback annotations
  • ❌ Only deploys to 100%

Option 2: Manual Deploy

  • ✅ More control over process
  • ✅ Can split traffic if desired
  • ❌ Manual version selection
  • ❌ No rollback annotations

Troubleshooting

”No stable version found”

If all recent deployments used traffic splitting:
Solution: Specify the version ID:

“Less than 2 deployments”

For new Workers:
Solution: You need at least 2 deployments to rollback. Deploy your first version, then make a second deployment before rollback is available.

Secret Changes Blocking Rollback

If you don’t want to confirm secret changes: Solution: Update secrets first, then rollback:

Next Steps

Deploying

Learn about deployment strategies

Version Management

View and manage versions

Secrets

Manage Worker secrets