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.
✓ Your current deployment has 2 version(s):(80%) a1b2c3d4-e5f6-7890-abcd-ef1234567890 Created: 2024-01-15T10:30:00.000Z Tag: v1.2.0 Message: New feature rollout(20%) b2c3d4e5-f6a7-8901-bcde-f12345678901 Created: 2024-01-14T15:20:00.000Z Tag: v1.1.0 Message: Stable version
2
Rollback target
The system identifies the rollback version:
⚠ You are about to rollback to Worker Version b2c3d4e5-f6a7-8901-bcde-f12345678901.This will immediately replace the current deployment and becomethe active deployment across all your deployed triggers.However, your local development environment will not be affected.Rolling back will not rollback any of the bound resources(Durable Object, D1, R2, KV, etc).
3
Confirmation
Confirm the rollback:
? Are you sure you want to deploy this Worker Version to 100% of traffic? (Y/n)
4
Complete
Rollback completes:
✅ Worker Version b2c3d4e5-f6a7-8901-bcde-f12345678901 has been deployed to 100% of traffic.Current Version ID: b2c3d4e5-f6a7-8901-bcde-f12345678901
When no version is specified, the rollback command finds the default target:
// From versions/rollback/index.ts:151-183async function fetchDefaultRollbackVersionId( config: Config, accountId: string, workerName: string): Promise<VersionId> { const deployments = await fetchLatestDeployments( config, accountId, workerName ); // sort by latest first deployments.sort((a, b) => b.created_on.localeCompare(a.created_on)); // we don't want to rollback to the current deployment deployments.shift(); for (const deployment of deployments) { // we define a stable version as one deployed to 100% const stableVersion = deployment.versions.find( ({ percentage }) => percentage === 100 ); if (stableVersion) { return stableVersion.version_id; } } throw new Error( "Could not find stable Worker Version to rollback to." );}
If secrets have changed since the target version was deployed, you’ll see an additional confirmation:
⚠ The following secrets have changed since version b2c3d4e5 was deployed.Please confirm you wish to continue with the rollback: * API_KEY * DATABASE_URL? Do you wish to continue? (y/N)