Home / Error library / Lovable blank page after publish
Lovable · BoltVite · SupabaseCommon publish bugLovable blank white page after publish
It looks fine in the editor preview, then you hit Publish and the live site is a blank white page. Here's what that usually means and how to fix it without guessing.
Uncaught Error: supabaseUrl is required.
at createClient (...)
You might also see supabaseKey is required, a red TypeError in the console, or no message at all — just white. Open the browser console on the live URL, not the preview.
Short answer
The preview and the published site are two different builds. Lovable's docs say the live site is a snapshot from your last publish, so editor changes do not reach it until you publish again. A blank white page usually means the live JavaScript crashed before the app could draw. The most common cause: a missing production environment variable (often VITE_SUPABASE_URL or the matching public key), so createClient throws supabaseUrl is required.
What the error means
Vite (the build tool behind many Lovable and Bolt apps) only exposes variables that start with VITE_ to frontend code, and it replaces them at build time. Per Vite's docs, those values are "statically replaced at build time." If the machine that built your live site did not have the variable, the finished files contain an empty string.
- Missing URL or public key.
createClient(undefined, ...)throwssupabaseUrl is required(orsupabaseKey is required). React never mounts. You see white. - Stale publish. You fixed the code in the editor but never clicked Publish changes, so the live snapshot is still the broken one.
- Crash on real data. Preview had a logged-in user or sample rows; the live page hits an empty list or a logged-out user and a
.maponundefinedkills the tree.
Always start with the first red line in the console on the live URL. Later red lines are usually side effects.
Why the AI caused it
In the Lovable or Bolt editor, the platform often injects backend settings into the preview for you. The AI writes import.meta.env.VITE_SUPABASE_URL and assumes it will always be there. On a fresh publish — especially if you moved the repo to Vercel, Netlify, or another host — those values are not automatic. The AI then "fixes" a blank page by hard-coding keys into source, or by wrapping every crash in a silent empty return. Don't let it put a secret key in the frontend.
VITE_ are baked into the client bundle. Vite's own docs say they "should not contain sensitive information such as API keys." Use only the public anon / publishable key in VITE_ variables. Keep service_role and other secrets in server code or edge functions.Source: Vite docs: Env Variables and Modes
Step-by-step fix
- Open the live URL, not the preview. Use your
*.lovable.appaddress, custom domain, or Bolt / Netlify / Vercel URL. Hard-refresh (Mac:Cmd+Shift+R, Windows:Ctrl+Shift+R) or use a private window so you're not looking at a cached old build. - Read the first red console error. Right-click → Inspect → Console, or press F12 /
Cmd+Option+J, then reload. Note the exact message. If it'ssupabaseUrl is requiredorsupabaseKey is required, continue below. If it's a TypeError about.map/undefined, skip to step 6. - Find the variable names your code expects. Search the project for
createClientandimport.meta.env. Typical names:import.meta.env.VITE_SUPABASE_URL import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY # or older: import.meta.env.VITE_SUPABASE_ANON_KEY
Copy the names exactly, including theVITE_prefix and spelling. - Set them where the live site is built.
- Still on Lovable hosting: open Publish. If it shows build errors, fix those first. Confirm the latest changes are published (a small dot on Publish means newer edits are waiting). Check Project → Settings → Domains if you use a custom domain — status should be Live.
- On Vercel, Netlify, Cloudflare, or similar: add each variable in that host's project settings for the Production environment, with the exact same names. Values: your Supabase Project URL and the public anon / publishable key from Supabase → Project Settings → API. Never paste the
service_rolekey here.
- Rebuild / republish. Saving an env var does not change files that already shipped. Trigger a new deploy or click Publish → Publish changes. Then reload the live page with the console open. The app should draw and the red error should be gone.
- If the console shows a TypeError instead. The page loaded but crashed on data — often an empty array or a logged-out user. Paste the exact error into Lovable/Bolt and ask it to guard the empty case (show a message instead of calling
.maponundefined). Add an error boundary so one bad component doesn't wipe the whole page. - If only inner routes are blank / 404 on refresh. That's a host routing issue (SPA fallback to
index.html), not the same as a white crash on the home URL. Fix the rewrite rule on your host, or stay on Lovable hosting which handles this for you.
service_role in a VITE_ variable, or telling the AI to "catch all errors and return null" so the blank page becomes a silent empty page.Copy-paste prompt for your AI tool
Paste this into Lovable, Bolt, Replit Agent or Cursor after you copy the first red console error from the live page.
My app works in the editor preview but the published / live site is a blank white page. On the LIVE url the browser console shows: PASTE_THE_FIRST_RED_ERROR_HERE Please: 1. Find where createClient (or the equivalent) reads import.meta.env and list the exact VITE_ variable names it expects. 2. Tell me where to set those for production (Lovable publish settings, or Vercel/Netlify/Cloudflare env vars) using ONLY the public anon/publishable key — never service_role. 3. If the error is a TypeError / undefined .map, guard the empty and logged-out cases and add a simple error boundary so one crash doesn't blank the whole page. 4. Confirm I must republish / redeploy after env changes. Rules: do NOT hard-code secrets into source, do NOT put service_role in any VITE_ variable, do NOT swallow errors with empty returns.
FAQ
Why is my Lovable app blank after I publish it?
The preview and the live site are separate builds. A blank white page usually means the live build crashed on load. The most common cause is a missing production environment variable, often VITE_SUPABASE_URL or the matching public key, so createClient throws supabaseUrl is required before React can draw anything.
What does supabaseUrl is required mean?
The Supabase client was created without a project URL. In Vite apps (including many Lovable and Bolt projects), that URL comes from a VITE_ variable that is baked in at build time. If the host that built the live site did not have that variable set, the value is empty and createClient throws.
I added the env vars. Why is it still blank?
Saving a variable does not change a build that already exists. Trigger a new publish or deploy so the values are included in the new files, then hard-refresh or open a private window and check the console again.
Does this also happen on Bolt?
Yes. Bolt apps that use Vite have the same build-time VITE_ rule. If you publish to Netlify, Vercel, or another host, set the same variable names there for production and rebuild.
Is it safe to put my Supabase secret key in a VITE_ variable?
No. Vite warns that VITE_ variables should not contain sensitive information. Only use the public anon or publishable key in frontend VITE_ variables. Keep service_role and other secrets on the server or in edge functions.
Fixed the blank page? Check what else is open.
A missing env var is the loud failure. The quiet ones are keys in your frontend, tables with RLS off, and auth that only looks like it works. The $15 pre-launch safety check finds them and gives you paste-in fix prompts.
Target turnaround 24h · Refund if it finds nothing useful
Sources
- Lovable docs: Publish your Lovable project
- Vite docs: Env Variables and Modes
- Bolt docs: Publishing issues
Last reviewed Nov 9, 2026. Unbreak My Code is independent and not affiliated with Lovable, Bolt, Vite or Supabase.