Fix guide · updated 2026-11-11
Lovable published site not working (but the preview works)
works in the preview · broken on the published site
Your app works in the Lovable preview. On the published address, something doesn't: login fails, a list is empty, an image is missing, a button does nothing. You ask Lovable to fix it, it checks the preview, finds nothing wrong, and says it's fine. The preview and the live site are the same app running in two different places. A short list of differences between those two places explains almost every case.
What's different between the preview and the live site
- The code. The preview runs your latest work. The live site is the copy from your last publish.
- The build. The preview runs on a development server. The live site is a built copy of your app, and a few things only work on the development server.
- The address. The preview has one web address and your live site has another. Sign-in providers, browsers and outside services treat them as two different sites.
- You. In the preview you're usually signed in to your app. On the live site you're a new visitor until you sign in there.
One thing is usually not different: the database. Lovable's docs say that "the preview and your published app share the same backend and data, so changes to your database affect both." The exceptions are payments (section 5) and older projects with separate Test and Live environments (section 4).
1. Find the real error on the live site
Open the published address in a private window, so nothing is left over from earlier visits. Right-click the page → Inspect, and look at two tabs:
- Console: copy the first red line.
- Network: reload, do the thing that fails, and look for a line in red. Click it and note its address, its status (401, 403, 404, 500) and what the Response tab says.
That's also what to send Lovable. A screenshot shows what is broken, and these lines show why. For example:
On the published site https://yourapp.lovable.app (not the preview),
clicking "Save" does nothing.
Console: [paste the first red line]
Failing request: POST https://.../rest/v1/orders, status 401
Response: [paste it]
The same click works in the preview. Find why the published site
behaves differently. Don't change anything yet, explain first.
Then find your case below.
2. The live site is behind your preview
Publishing deploys a copy of your project as it was at that moment. Later changes stay in the preview until you click Publish, then Publish changes. A small dot on the Publish button means the live site is behind. See Lovable publish not working if the publish itself fails.
What makes this confusing is that, on most projects, the database doesn't wait for a publish. Rename a column or change a table while you build, and the change is live at once, while the published pages are still the old ones. The preview works with the new database. The live site's old pages ask for things that are gone, and sections come up empty or show errors. Publishing brings the pages back in line with the database.
The same goes for server code in newer apps. Lovable's docs say that in apps created from May 13, 2026, server functions and API routes "are part of the app, so changes to them go live when you publish." Until then only the preview runs the new version. A change of AI model works the same way: "Until you publish, only the preview uses it."
3. Sign-in works in the preview and fails on the live site
After a login, your users are sent back to your app, and only to addresses on an approved list called Redirect URLs. Lovable's docs name this as the usual cause: the published address or the custom domain is missing from that list.
- App on Lovable's built-in backend. Lovable adds your published address and your custom domain to the list by itself. If sign-in still fails, look under More → Users → Settings → Advanced → Redirect URLs, or ask Lovable in the chat to add your domain to the auth redirect URLs.
- App on your own Supabase project. Lovable adds its own addresses, but the Site URL and any other address are yours to set in Supabase. The steps are in Supabase login redirects to localhost.
- Google sign-in with your own Google credentials. After you connect a custom domain, Lovable lists a new redirect URL under More → Users → Settings → Google but doesn't select it. Add that URL as an Authorized redirect URI on your OAuth client in Google Cloud Console, then select it in Lovable and click Save. Until you do, Google shows a redirect URI mismatch error on the new domain. Google sign-in managed by Lovable needs no change.
4. Data shows in the preview and the live site is empty
The database is the same, so the data is there. What differs is who is asking for it. A browser keeps a separate sign-in for each address, so being signed in inside the preview doesn't sign you in on the live site. And your database's access rules (row-level security) decide which rows each person gets. For someone who isn't allowed, the database doesn't answer with an error. It answers with an empty list: status 200, [], nothing red in the console.
- On the live site, sign in with the same account you use in the preview. If the data comes back, the app works. If signed-out visitors should see that page too, ask Lovable for a rule that lets everyone read exactly those rows, and nothing more.
- If a second account sees nothing, your rules only show each person their own rows. For private data that's correct. For shared data, the read rule needs to change.
- If the request fails with a 401 or 403 and a message, the message names the problem: see permission denied for table (42501) or new row violates row-level security policy.
One exception: older projects that turned on Lovable's Test and Live environments, a beta that closed to new projects on March 24, 2026. There the preview and the live site have separate databases: rows you add while testing never appear on the live site, and changes to your tables reach the live database only when you publish.
5. Payments work in the preview and not on the live site
With Lovable's built-in payments, the preview runs in test mode and the published app in live mode. Each has its own products, prices and history. The docs are direct about it: "Checkout on your published app will not process real payments until you complete the go-live steps", which means your payment provider's verification, a readiness check, and a publish. It also works the other way: the preview only accepts test card numbers, so a real card fails there.
If you connected your own Stripe account instead, live mode has its own API keys, its own price IDs and its own webhook signing secret. A live site still using test values fails at checkout, or the payment goes through and your app never hears about it. See Stripe webhook 400 in a Supabase Edge Function.
6. An image or a file is missing on the live site
We tested this one on Vite, the tool that builds Lovable apps. An image whose address is typed as text and starts with /src/ loads on the development server and is missing from the built site:
<img src="/src/assets/hero.png" />
The build only keeps files that your code imports, or that sit in the public folder. In our test nothing red appeared in the console. In the Network tab, the image's line came back as a web page (text/html) instead of an image. Two ways to fix it:
// 1. import the file, and the build keeps it
import hero from "@/assets/hero.png";
<img src={hero} alt="" />
// 2. or move it to public/hero.png and use a path without /src
<img src="/hero.png" alt="" />
Ask Lovable to find every image, font or file referenced by a text path starting with /src/ and import it instead. It's the same cause each time.
7. A request is blocked on the live site only
The console shows a line like this one, from our test in Chrome:
Access to fetch at 'https://api.example.com/data' from origin 'https://yourapp.lovable.app' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'https://preview-address.example' that is not equal to the supplied origin.
Your own code only sees TypeError: Failed to fetch, which is why the button seems to do nothing. The server you're calling keeps a list of the sites allowed to call it from a browser, and that list has your preview's address, not your live one. It can be one of your own backend functions or an outside service. API keys limited to certain websites (maps, captchas, analytics) fail for the same reason. Add your live address, and your custom domain if you have one, everywhere the preview's address was entered: in the function's allowed origins, and in the outside service's dashboard.
If the line says No 'Access-Control-Allow-Origin' header is present instead, the function isn't answering browsers properly at all. See Edge Function returned a non-2xx status code.
8. The whole live site is down, blank, or asks visitors to log in
- Visitors hit a login wall: the site's audience is set to Invite only in the Publish dialog.
- Nothing loads from the backend: a paused built-in backend takes the database, sign-in and file storage down with it, so the live app stops working until you click Wake up under More → Database. An app that uses the built-in backend also needs credits available to answer requests.
- Blank page on Vercel, Netlify or another host: see Lovable blank page or 404 after deploy.
The first two are covered in Lovable publish not working.
Still stuck?
Do the same action in the preview and on the live site with the Network tab open in both, and compare the two lists of requests. The first request that differs, by its address, its status or its answer, is where the problem is. Write that down with the first red console line. It's what anyone helping you will ask for first.
Other Lovable app problems? See Fix a Lovable app.