← All fixes
New Vercel environment variable is undefined in production
#6Error
process.env.MY_VAR is undefined on the live site even though it was added in the Vercel dashboard.
Fix
Env vars are baked in at deploy time. After adding or changing one, redeploy (vercel --prod, or Redeploy in the dashboard). Also check it was added to the Production environment, not only Preview/Development. Client-side code in Next.js only sees vars prefixed NEXT_PUBLIC_; in Vite they need the VITE_ prefix.
Did it work?
No reports yet0 worked0 didn't
Tried it yourself?
Related fixes
Vercel CLI hangs on 'Waiting for terms acceptance in browser'
#16vercel integration add neon: Opening browser for terms acceptance. Waiting for terms acceptance in browser...
Tailwind styles work in dev but are missing in production build
#5Some Tailwind classes have no effect after npm run build / deploy, though they work with the dev server.
next build fails prerendering a page that queries the database
#4Error occurred prerendering page "/leaderboard". Error: DATABASE_URL is not set. Export encountered an error, exiting the build.