#4 most commonenv/configLovableBolt.newCursorReplitv0Windsurf
Environment variables are undefined (VITE_ / NEXT_PUBLIC_ prefix, or not set on host)
import.meta.env.VITE_API_URL is undefined / process.env.NEXT_PUBLIC_... is undefined / Missing environment variable
Got a slightly different error? Paste the exact message and get a fix prompt tailored to it.
Paste your error →What it means
Your app's settings (like keys and URLs) aren't reaching the code. Either they're named without the prefix the framework requires, or they were never added to your hosting service.
How to fix it: paste this prompt into your AI builder
Fix prompt for Lovable, Bolt, Cursor, Replit, v0, Windsurf
My environment variables come through as undefined. Check: (1) for Vite, browser-side variables must start with VITE_ and be read via import.meta.env.VITE_X; for Next.js, browser variables must start with NEXT_PUBLIC_; (2) the .env file is in the project root and the dev server was restarted; (3) the code reads the exact same names. Give me a list of every env var the app needs, which ones are safe for the browser vs server-only, and confirm no secret keys (Stripe secret, OpenAI key, Supabase service_role) are exposed to the browser. Don't change unrelated code.
If the AI can't fix it: manual steps
- Add the same variables in your host (Vercel/Netlify Settings, Environment Variables) for Production, then REDEPLOY; Vite bakes them in at build time.
- Never put secret keys in VITE_ or NEXT_PUBLIC_ variables; anyone can read them.
Where this happens
Seen in these AI app builders and editors:
LovableBolt.newCursorReplitv0Windsurf
Sources
Related env/config errors
Still stuck? Paste your full error and UnstuckMyVibe will match it and hand you the exact fix prompt.
Fix my error →