NEXT_PUBLIC_CONVEX_URL & preview deployments with Vercel
When I create a preview deployment in Vercel, does Convex set the
NEXT_PUBLIC_CONVEX_URL
preview environment variable automatically during the build?
It doesn't seem to be set dynamically - my Vercel preview deployment isn't connecting to my Convex preview deployment.3 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
@erquhart Any ideas on this one?
After playing around with this for a bit, it looks like
npx convex deploy
sets the NEXT_PUBLIC_CONVEX_URL
env variable on the Vercel deployment, but not the NEXT_PUBLIC_CONVEX_SITE_URL
env variable. Additionally, how can I push the Vercel deployment URL to the Convex backend as an environment variable?I can't remember if there's a better solution for this, but I'd personally just replace .cloud with .site on NEXT_PUBLIC_CONVEX_URL