How to roll back
The Deployments tab lists every deploy with its status and, for deploys from GitHub, the commit it built. Choose Roll back next to an earlier version that went live to return to it, or use the Roll back button on the app’s page to return to the last version before the current one. Your coding agent can do the same withPOST /api/v1/rollback, which takes the
application and, optionally, the deployment to return to. A deploy that is
already running has to finish first.
Or put the code back yourself
Rolling back builds an old version again. You can also put the old code back and deploy it like any other change.- GitHub
- Coding agent
- Folder upload
Revert the commit that broke things and push:With deploy on push turned on, the push is the deploy.
git revert adds a
new commit that undoes the old one, which is safer than rewriting history
on a branch other people use.What a failed deploy leaves running
This depends on where the deploy stopped, and it is the part most worth understanding in advance.
The first row is the common case: a build error or a failed migration, and your
app keeps running as it was. The other two happen after the new version has
taken the old one’s place, because each app runs on a single instance and a
release replaces it. The app stays down until a version that starts is
deployed, which is either a fix or the previous code put back as above.
Undoing code does not undo a migration
Putting old code back does not reverse a database migration. If the deploy you are undoing added a column, dropped a table, or rewrote data, the old code now runs against the new schema. Sometimes that is fine, because the old code simply does not know about the new column. Sometimes it is not, because the old code selects a column the migration renamed.Deciding quickly
When something is wrong in production, the useful question is not what broke, it is whether the previous version was fine. If it was, put it back first and diagnose after. A few minutes of redeploying the old code beats twenty minutes of debugging under pressure. Once you are no longer on fire, the deployment list gives you the commit each deploy built, so the difference between what worked and what did not is one comparison away.Health and alerts
Health checks run every few minutes, and you are emailed when an application
changes state rather than on every check. That is usually how you find out you
need this page.