VibeDict

🚀Missing environment variable

What you'll see
Error: Missing environment variable: DATABASE_URL

A value kept outside the code, like a secret key or database address (an environment variable), couldn't be found.

🤔 Why does it happen?

  • The value isn't in the .env.local file, or its name is different
  • It wasn't added to the environment variable settings of your hosting service (Vercel, etc.)
  • The server wasn't restarted (or redeployed) after adding the value
  • It's used in the browser, but the name doesn't start with NEXT_PUBLIC_ (Next.js)

🔧 Try this

  1. Compare the variable names one letter at a time
  2. On Vercel, add it in Settings → Environment Variables, and be sure to deploy again (Redeploy)
  3. On your computer, save .env.local, then stop and restart the dev server

🤖 Ask your AI like this

I get an error like the one below saying an environment variable can't be found. Please list the environment variables this project needs and where to get each one, and tell me how to add them on my computer (.env.local) and on Vercel. Don't ask me for the actual values. [Paste the full error here]

Replace the [ ] parts with your own situation, and paste the error with a few extra lines before and after it.

Related terms

Other errors in this group