Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
||
| 1. **Vercel retains preview deployments for 6 months by default.** As of [October 2025](https://vercel.com/changelog/updated-defaults-for-deployment-retention), Vercel's default retention for pre-production deployments is 180 days. The clock starts when the deployment is created, not when the PR is closed. | ||
| 2. **After retention expires, there's a 30-day recovery period.** During this window, Vercel holds the deployment in a recoverable state. Only after this period ends is the deployment permanently deleted. See [Restoring a deleted deployment](https://vercel.com/docs/deployment-retention#restoring-a-deleted-deployment). | ||
| 3. **Neon deletes the branch after permanent deletion.** Neon receives a cleanup webhook from Vercel only after the deployment is permanently removed. |
There was a problem hiding this comment.
We delete the branch when we receive the webhook from Vercel, and based on my tests, when I manually delete the deployment, we received the webhook immediately (not after 30 days). I don't remember if I checked if this grace period applies only to the retention policy. Could you please double-check this?
There was a problem hiding this comment.
Yes, manually deleting the deployment via vercel does immediately delete it and the associated neon branch. I'm still testing the other scenarios in relation to retention policy. Once done testing I'll clarify.
| 2. **After retention expires, there's a 30-day recovery period.** During this window, Vercel holds the deployment in a recoverable state. Only after this period ends is the deployment permanently deleted. See [Restoring a deleted deployment](https://vercel.com/docs/deployment-retention#restoring-a-deleted-deployment). | ||
| 3. **Neon deletes the branch after permanent deletion.** Neon receives a cleanup webhook from Vercel only after the deployment is permanently removed. | ||
|
|
||
| In the worst case (a deployment created moments before the PR is closed), this means up to **~7 months** before the Neon branch is automatically deleted. In practice, the delay is often shorter for long-running PRs. |
There was a problem hiding this comment.
the delay is often shorter for long-running PRs.
You meant longer, didn't you?
There was a problem hiding this comment.
I meant longer but it's poorly worded and confusing, so will update. Thanks!
| - The last 10 deployments created in the project | ||
| - Deployments with custom aliases or branch aliases | ||
|
|
||
| Neon branches associated with these retained deployments won't be automatically deleted regardless of your Vercel retention settings. In practice, this means that if your project has 20 or fewer preview deployments, **none of them will be auto-deleted by Vercel's retention policy** since they all fall within the "last 20" exception. |
There was a problem hiding this comment.
What?! I didn't know this.
|
|
||
| --- | ||
|
|
||
| ## Workarounds for immediate cleanup |
There was a problem hiding this comment.
It's worth noting that deleting branches (whether via a GH Action, CLI/API, or TTL) invalidates the existing Vercel deployments.
There was a problem hiding this comment.
Good point, will mention this.
Under review, do not merge. Main Preview.
Explains why Neon preview branches can persist for months with the Vercel-Managed integration due to Vercel's deployment retention policy (default 180 days + 30-day recovery period).
Adds a dedicated guide covering the cleanup timeline, retention exceptions, how to reduce retention, and workarounds including a GitHub Action for immediate cleanup on PR close. Slims down cleanup sections in the existing integration pages to link to the new guide, and adds cross-references from the Vercel overview and cost optimization pages.