What you see
Everything works in the Lovable editor. You click Publish, open your lovable.app link or your custom domain, and one of these happens:
- a blank white page, sometimes with
Error: supabaseUrl is required.in the console - the page loads, but lists are empty or saving does nothing for anyone but you
- “Login with Google” or the email link sends you back to the preview address or to
localhost - the live site simply doesn’t have the fix you made an hour ago
A post on r/lovable listing the most common breaks in Lovable and Bolt apps puts it plainly: “Login with Google” works in preview, breaks when you publish, because the Site URL still points at localhost or the old preview URL. “Two-minute fix when you know where to look, can eat your whole weekend if you don’t.”
Why preview and live differ
Lovable’s preview docs describe the preview as your staging space that “always runs your latest work”, while visitors see “a snapshot that only changes when you publish”. Two details matter:
- The live site is a separate, older build. Publishing “deploys a copy of your project” and later changes “do not reach your live app on their own”.
- The data is not separate. The same preview page says “the preview and your published app share the same backend and data”. So if lists are empty on the live site, it’s rarely a different database. It’s usually who is asking: in preview you’re signed in as yourself; a visitor isn’t.
Work through the list in order. Each step takes a minute or two.
Fix it
1. Publish the version you’re looking at
Open the Publish dialog. Lovable’s docs say a small dot on the Publish button means your project has changes newer than the live version. Click Publish changes. If the dialog shows Try to fix instead, your latest changes failed to build. Fix those first, then publish.
One trap: accepting a draft is not publishing. Per the publish docs, when you accept a draft its database structure, storage and backend function changes “take effect in your live app immediately”, but visitors see the new pages “only after you publish”. For a while the live pages run against the new database structure. Publish right after you accept.
Then hard-refresh the live URL (Ctrl+Shift+R, or Cmd+Shift+R on a Mac) or try a private window.
2. Read the first red error on the live URL
On the published address, not the preview: press F12, open Console, reload. Then open Network, reload again and look for red rows. Click one and check where it went: your Supabase project, a preview address, localhost, or a /assets/*.js file that 404s.
| What you see on the live URL | Go to |
|---|---|
supabaseUrl is required. / blank page |
step 3 |
| Empty lists, insert fails, only for visitors | step 4 |
Sign-in returns to preview or localhost, redirect_uri_mismatch |
step 5 |
| Requests to your backend fail, or nothing loads data | step 6 |
/assets/index-….js 404 or MIME text/html error (code hosted outside Lovable) |
Vite base path guide |
| Inner pages 404 when you refresh (code hosted outside Lovable) | 404 on refresh |
3. Check the build-time VITE_ values
The browser code reads VITE_SUPABASE_URL and VITE_SUPABASE_PUBLISHABLE_KEY. Lovable’s Secrets docs are specific about where they live:
- They belong in the project’s
.envfile, not in Secrets. Secrets are for backend code only, and Lovable rejectsVITE_names there. - They are “embedded into the client bundle at build time”.
- “Do not add
.envto.gitignorein a Lovable project.” Lovable needs it committed so the values are there “when generating previews and published builds”.
If you (or your AI) moved the code to Vercel, Netlify or Cloudflare Pages, the host doesn’t have your .env. Lovable’s external hosting guide says to set VITE_SUPABASE_URL and VITE_SUPABASE_PUBLISHABLE_KEY “before the build, since browser values are embedded at build time”. The full fix, with each host’s settings page, is in supabaseUrl is required. Never put a secret or service_role key in a VITE_ variable: it ships to every visitor.
4. Test as a signed-out visitor (RLS)
Open the live URL in a private window and use the app as a stranger would. If lists are empty or saves fail there, but work for you in the editor, look at Row Level Security.
Supabase’s RLS docs map every request to a role: anon when “the user is not signed in” and authenticated when they are. And “once RLS is enabled, no data is accessible through the API when using a publishable key, until you create policies.” A table with a policy only for your own user, or only for authenticated, looks fine in preview and empty to everyone else.
- Reads empty for visitors: decide whether that data should be public. If yes, add a
selectpolicy foranon. If not, the app should send them to sign in, not show an empty page. - Inserts fail with
new row violates row-level security policy: see that guide. - The opposite problem, a table anyone can read or write, is worse. See RLS disabled / table publicly accessible.
5. Fix the Site URL and redirect URLs
Lovable’s authentication docs say it directly: “If sign-in works in preview but breaks on your published app or custom domain, these URLs are usually the reason.” What to do depends on your backend:
- Built-in backend (Lovable Cloud). “When you publish, Lovable sets the Site URL to your app’s published address”, and when you connect a custom domain “Lovable adds it to the redirect URLs”. You can see the full list under More → Users → Settings → Advanced → Redirect URLs. If it still fails, the docs suggest asking Lovable in the project chat to add your domain to the auth redirect URLs.
- Your own Supabase project. “The Site URL and any address Lovable does not serve are yours to set.” In Supabase, open Authentication → URL Configuration. Supabase’s redirect URL docs say the Site URL is the default redirect “when no redirectTo is specified” and to change it “from http://localhost:3000 to your production URL”. Step by step: redirects to localhost:3000.
- Google sign-in with your own Google OAuth credentials. The new domain also needs a redirect URI in Google Cloud Console, or Google shows Error 400: redirect_uri_mismatch.
Also search your code for a hard-coded preview address (lovable.app, lovableproject.com) in redirectTo or emailRedirectTo. Use window.location.origin so the same code works in preview and live.
6. Check the backend, credits and domain
- Credits. Per the publish docs, “Apps that use the built-in backend or AI features do need available credits to serve requests.” The page can load while data and logins fail.
- Paused backend. Per Lovable’s built-in backend docs, pausing the database pauses user accounts and file storage too. Wake it under More → Database. With your own Supabase project, check the Supabase dashboard (see project paused / 540).
- Custom domain still setting up. Lovable “publishes your app to the
lovable.appaddress until the domain shows Active”. Test thelovable.appaddress to rule DNS out. - “App temporarily unavailable”. Lovable’s hosting docs say newer apps in workspaces without a paid plan are limited to 1,000 server requests per project per 10 seconds; above that, visitors see this page and can retry after a minute.
- Restricted audience. If you published as Invite only, visitors must log in to see the site. That’s by design, not a bug.
A prompt for your AI builder, once you know which step applies: “The published site at https://my-app.lovable.app shows [paste the first red console error]. Preview works because I’m signed in. Don’t change the UI. Check the .env VITE_ values, the RLS policies for anon and authenticated on the tables this page reads, and that redirectTo uses window.location.origin.”
Check it worked
- In a private window, open the live URL: no red errors in the console, and the pages a visitor should see have data.
- Sign up and sign in on the live URL. The confirmation email link and Google sign-in both return to the live address, not the preview or
localhost. - Sign in as a second test user and confirm you can’t see the first user’s rows. Fixing “empty for visitors” by opening a table to everyone trades one bug for a data leak.
- Publish again after any fix, and recheck the dot on the Publish button is gone.
Lovable’s own scan checks a lot before you publish; here’s what it covers and what it doesn’t. Run the free production-readiness checker on your live URL to catch exposed keys, leftover localhost URLs and refresh 404s. If real users or payments are about to hit this app, a written pre-launch audit reviews auth, RLS policies, payments and hosting with you before launch.