Skip to content
Tutorials Center
My learning

Topics

Lesson 30 of 37 Β· Previews and Teams

Rollbacks and Promotions

Undo a bad release in seconds: how immutable deployments enable instant rollback on Vercel and Netlify, promoting a preview to production, locking deploys and safe database changes.

Sooner or later a release goes wrong: a typo breaks the checkout button, or a dependency update crashes every page. The best answer is not a frantic fix under pressure but a calm rollback: point production back at the last good version. On Vercel and Netlify this takes seconds, because deployments are immutable.

The dashboards cannot run here, so no screenshots. Steps are described from documentation and button names may change. The runnable code is a JavaScript stand-in that models a deployment list with rollback and promotion.

Why rollback is instant

Each build produces a complete, frozen snapshot: static files, function bundles and configuration. The platform never edits it afterwards. "Production" is just a pointer from your domain to one of those snapshots. A rollback moves the pointer back to an older snapshot that already exists, so there is nothing to rebuild. That is also why the old version works exactly as it did, with the same files and the same function code.

flowchart LR
  D["Domain: example.com"] --> P{"Production pointer"}
  P -.->|"before"| V1["Deployment v41 (good)"]
  P ==>|"after release"| V2["Deployment v42 (bad)"]
  P -.->|"rollback"| V1

Rollback changes the pointer, not the deployments.

Rolling back

On Vercel: open the project's Deployments list, pick an earlier production deployment and use Instant Rollback (from its menu). Production aliases switch to it immediately. After a rollback, automatic assignment of new Git pushes to production is paused for that project until you promote a deployment or turn it back on, so a later push does not silently overwrite your fix; the dashboard tells you this.

On Netlify: open Deploys, pick an earlier deploy and choose Publish deploy. This also stops auto-publishing for the site (deploys are locked) until you click Start auto publishing. Netlify calls this "locking" the published deploy.

Both are also available through the CLI and APIs, so a monitoring system can roll back automatically when error rates spike.

Promoting a deployment

Promotion is the opposite direction: take a deployment that already exists, often a preview or a staging build you tested, and make it production without rebuilding. Advantages: what you tested is byte-for-byte what ships, and no new build can fail or differ. On Vercel use Promote to Production on a preview deployment (with environment variable caveats: it keeps the preview build's variables, so use it for builds made with production settings). On Netlify, publishing a chosen deploy is the same act.

Typical flows:

Goal Action
Normal release merge to the production branch, platform builds and publishes
Verified staging build goes live promote that exact deployment
Bad release roll back to the previous production deployment
Hotfix while auto-publish is locked publish the fixed deployment manually, then re-enable auto publishing

Release safety

Immutable Each deployment is a frozen copy.
Pointer Production points at one of them.
Rollback Move the pointer back.
Promote Ship a tested build as is.

No rebuild needed for either.

1 / 2

A deployment history model

The stand-in keeps a list of deployments with an active production pointer and an auto-publish flag, showing how rollback pauses auto-publish and how promotion works.

JS Rollback stand-in

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Rollbacks and your database

A rollback reverts code, not data. If release v42 ran a migration that dropped a column v41 needs, rolling back to v41 breaks it again. The safe pattern is expand and contract:

  1. Expand: add the new column or table; keep the old one. Old and new code both work.
  2. Deploy code that reads and writes the new structure.
  3. Later, once you will never roll back past this point, contract: remove the old column.

Also remember that environment variables are part of what a deployment captured at build time on some platforms, and that changing a variable usually needs a new deployment to take effect. Check what your plan does before relying on it during an incident.

Deciding the order: a quick triage model

When production breaks, the cheapest, safest action is usually to restore service first and investigate second. This stand-in encodes that thinking as a simple decision function.

JS Incident triage stand-in

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Good habits

  • Practice a rollback on a calm day so you know where the button is.
  • Keep releases small; small diffs are easier to revert and to blame.
  • Name your production branch deployments clearly with commit messages.
  • After a rollback, re-enable auto publishing once a fix is ready, or new merges will not go live.
  • Write a short post-incident note: what broke, how you noticed, what prevents a repeat.

Check your understanding

Quick check Β· 4 questions

of 4 answered You scored / 4 Β· perfect!

  1. 1. Why can a rollback be nearly instant?

    Nothing is rebuilt. The platform repoints the production alias to an existing deployment.
  2. 2. What happens to auto-publishing after a manual rollback or publish on Netlify?

    Locking prevents the next push from replacing the version you just restored. Re-enable it when ready.
  3. 3. What is the benefit of promoting a tested deployment instead of rebuilding?

    No new build means no chance for the output to differ from what was verified.
  4. 4. Why is the expand and contract pattern used with rollbacks?

    Compatible schema changes keep the previous version functional after a rollback.

Summary

  • Deployments are immutable; production is a movable pointer.
  • Rollback repoints production to an older deployment, usually pausing auto-publishing.
  • Promotion ships an already tested deployment without rebuilding.
  • Data and schema are not rolled back: use expand and contract.
  • Practice rollbacks and re-enable auto publishing afterwards.

Next: Caching and the CDN