When creating a new chat for an existing project running on Vercel using the NeonDB integration, a new git branch is created as expected, safeguarding main. However, the chat still uses the same production environment variables the app is running with in production.
Current Behavior
No new NeonDB branch is created (though it works fine when creating a new branch outside of v0).
VERCEL_ENV and NEXT_PUBLIC_VERCEL_ENV are not set to preview or development as expected.
This is dangerous because the development environment pushes migrations on start, which could break production.
I’d treat this as a potentially risky env/branch-mapping issue and disable any automatic migration-on-start behavior until you confirm which database the v0 chat is actually using.
A safe way to debug it is to log only the environment and Neon host/branch, not the full connection string or password:
If the v0 chat/preview shows production or points at the same Neon host/branch as production, then I would not run migrations from that environment.
In Vercel, I’d also check:
Project Settings → Environment Variables
and confirm whether DATABASE_URL / POSTGRES_URL have separate values for Production and Preview. Preview env vars are used for non-production branches, and branch-specific Preview values can override the general Preview value.
Neon’s Vercel preview integration is supposed to create a preview/<git-branch> branch and inject the connection string into that deployment, so if that branch is not being created, I’d check the Neon integration events and branch limit first:
and only allow destructive or auto migrations when an explicit non-production flag is set, for example ALLOW_PREVIEW_MIGRATIONS=true.
Can you share whether the v0 chat is connected to a Git branch that creates a normal Vercel Preview Deployment, or whether it is running only inside the v0 preview/chat environment?