Fix Prisma migrations hanging on Vercel (direct DB connection)#2
Merged
Differ3nce merged 3 commits intomainfrom Feb 25, 2026
Merged
Fix Prisma migrations hanging on Vercel (direct DB connection)#2Differ3nce merged 3 commits intomainfrom
Differ3nce merged 3 commits intomainfrom
Conversation
Supabase's pgBouncer (port 6543) doesn't support advisory locks required by prisma migrate deploy. Add directUrl to use the direct connection (port 5432) for migrations while the app continues using the pooler for queries. Also restore vercel-build script so migrations run automatically on deploy. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Prisma 7 removed url/directUrl from schema.prisma datasource blocks. Migration URLs are now configured in prisma.config.ts instead. Using DIRECT_URL (port 5432) here bypasses pgBouncer so advisory locks work. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
vercel-build was not being picked up by Vercel's Next.js preset. Moving migrate deploy into the standard build script ensures it runs on every deployment. It is idempotent so prod is unaffected. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
directUrlto the Prisma datasource pointing toDIRECT_URLenv var — this routesprisma migrate deploythrough Supabase's direct connection (port 5432) instead of pgBouncer (port 6543), which does not support the advisory locks Prisma needsvercel-buildscript so migrations run automatically on every Vercel deployRequired action
Add
DIRECT_URLto Vercel environment variables for all environments — same Supabase credentials asDATABASE_URLbut with port5432and without?pgbouncer=true.Test plan
prisma migrate deploywithout hanging🤖 Generated with Claude Code