RichardR
Convex Community5w ago
1 reply
Richard

VITE_CONVEX_URL envvars not set in preview builds on Vercel

🔑AuthAdvice
I am using BetterAuth + tanstack start + Vercel.

I followed this guide: https://labs.convex.dev/better-auth/framework-guides/tanstack-start#configure-tanstack-server-utilities

However when I deploy a preview build on Vercel, process.env.VITE_CONVEX_URL and process.env.VITE_CONVEX_SITEURL are both undefined in the server route in TanStack.

This implies that
npx convex deploy --cmd 'npm run build
⁩ did not properly set the VITE
envvars, or perhaps these are not persisted at runtime when the server routes are invoked.

How can I fix this? I have confirmed the CONVEX_DEPLOY_KEY is properly set to the preview deploy key.
Install and configure Convex + Better Auth for TanStack Start.
Was this page helpful?