Fixes · Deploys that break

Works locally, blank or broken in production: missing environment variables

The deployed app shows a blank page or errors that never happen locally. Usually a key the code reads was set on your computer, or in the AI tool, and never on the host.

Most common in apps built with Lovable, Bolt, v0.

What you see

A white screen, "supabaseUrl is required", undefined in place of a value, or sign-in redirecting to localhost, only once deployed.

Why it happens

The code reads values like VITE_SUPABASE_URL from the environment. Your .env file, or the tool's secrets panel, set them where you built it; the new host has none of them. Links or sign-in redirects written as http://localhost:… break in the same way.

How to fix it

  1. List every variable the code reads (process.env.X, import.meta.env.X) in a .env.example, names only.
  2. Set each one at the host for production and previews. Values that start with NEXT_PUBLIC_ or VITE_ are visible to everyone: never put a secret in one.
  3. Replace hard-coded localhost addresses with a variable such as NEXT_PUBLIC_SITE_URL.
  4. Redeploy: most hosts only read variables at build time.

Or ask your AI tool to fix it

Paste this into Lovable, Bolt, v0, Replit or Cursor, and let it make the change.

My app works locally but not when deployed. List every environment variable the code reads in .env.example (names only, no values), and replace any hard-coded localhost URL with one read from an environment variable. Don't put any secret value in the code.

Don't change what the app does.
Never put a secret key or password in the code: read it from an environment variable.
If a step has to be done outside the code, like revoking a key in a provider's dashboard, list it for me at the end instead of skipping it.

How Launchpad helps

The launch check lists every variable the code reads that isn't written down. Launchpad sets the keys of every service it creates (database, sign-in, email, storage) in each environment for you.

Check your app for this, freeJoin the waitlist

Related