---
title: "Why does my app work in preview but break on the live site?"
description: "Works in preview, breaks on the live site? Four causes cover most cases: not republished, 404 on refresh, sign-in redirect, missing key. Check in order."
url: https://whocanfixmyapp.com/questions/works-in-preview-breaks-on-the-live-site
---

[Home](https://whocanfixmyapp.com/) / [Problems](https://whocanfixmyapp.com/problems) / Question

# Why does my app work in preview but break on the live site?

Updated October 2026 · By [Nathaniel Kelley](https://whocanfixmyapp.com/authors/nathaniel-kelley)

Quick answer

The preview and the live site are different builds with different settings. Almost always it is one of four things: you did not republish, a refreshed page returns 404, the sign-in redirect is not allowed on the live domain, or a key that existed in the editor is missing on the host.

- **Applies to**: Any AI builder
- **Checks to run**: [OPS-04](https://whocanfixmyapp.com/checklist#OPS-04), [AUTH-01](https://whocanfixmyapp.com/checklist#AUTH-01), [OPS-02](https://whocanfixmyapp.com/checklist#OPS-02), [PAY-01](https://whocanfixmyapp.com/checklist#PAY-01)

The preview is the editor's own view of your project. The live site is a copy made at one moment and served from somewhere else. Lovable's docs say it plainly: the published site is a snapshot, and edits after publishing do not reach visitors until you publish again. Replit deployments work the same way, running a saved snapshot so editor changes do not affect the live build. So ask first: did you publish after the last change?

If you did, the next four causes cover most cases:

1. **A refresh returns 404.** Lovable's older React apps build to static files. The host must return `index.html` with a 200 status for any route that is not a file. Without that rule, the home page works and every deep link or refresh fails. Netlify and Cloudflare use a `_redirects` file, Vercel uses `vercel.json`.
2. **Sign-in fails only on the live domain.** Your auth provider keeps a list of allowed redirect URLs. The preview URL is on it. Your custom domain is not. Add it in Supabase, and in Google or GitHub if you use them.
3. **A key or setting is missing on the host.** Lovable embeds `VITE_SUPABASE_URL` and the publishable key at build time, so changing them needs a rebuild. On Replit, secrets for the published app are set separately under Publishing. On v0 and Next.js, only `NEXT_PUBLIC_` variables reach the browser, and server secrets must be set on Vercel.
4. **The live database is not the preview database.** On Replit, publishing creates a separate production database. Rows you added while building are not there unless you copied them. Testing and real users should use different databases, so this is correct, but it looks like data loss.

Two more that catch apps with payments. Stripe test keys work in preview and live keys are set on the host, or the other way round. And the Stripe webhook still points at the preview URL, so payments succeed and the app never hears about them.

What to check, in order:

- Publish again and hard-refresh the live site.
- Open a deep link on the live site and press refresh. If you get 404, add the fallback rule.
- Sign in on the live domain and read the error. A redirect error means the URL list.
- Open the browser's developer tools on the live site, then the Console and Network tabs. A failed request names the missing key or the wrong URL.
- For Lovable custom domains, open Project, Settings, Domains and confirm the status reads Live.

Money and time. Most of these are a single fix at €99–$990, about two days. A check that goes through all of them is $49–$800. See [pricing](https://whocanfixmyapp.com/pricing).

Get help when the console shows errors you cannot read, when the live site reaches a database you do not recognize, or when payments go through and nothing unlocks. The [Claude Code guide](https://whocanfixmyapp.com/guides/claude-code) covers the localhost version of this problem, and [v0](https://whocanfixmyapp.com/guides/v0) and [Bolt](https://whocanfixmyapp.com/guides/bolt) have their own pages.

## Check these

OPS-04 · Medium

Secrets live in the host's environment settings

Keys belong in environment variables on the server, not in the repository or in front-end code.

AUTH-01 · High

Sign-up confirmation and password reset work end to end

Use a real inbox. Check that the link arrives, points to your live domain, and works once.

OPS-02 · High

Testing and real users use separate databases

Experiments and AI agents should never run against production data.

PAY-01 · Critical

Paid accounts are unlocked by a verified payment webhook

Access should change only when your server receives a signed webhook from Stripe or your provider, not when the browser reaches a success page.

## Top-rated companies

Ranked by our score: published prices, scope of work, AI tools named, timing and a low-risk first step. [How we score](https://whocanfixmyapp.com/methodology#score).

- 1 · [Afterbuild Labs](https://whocanfixmyapp.com/companies/afterbuild-labs) · **10.0**/10 · Best for: A check before launch · Free first step · from $49
- 2 · [Redlab](https://whocanfixmyapp.com/companies/redlab) · **10.0**/10 · Best for: A full rescue by one team that keeps building · Free first step · from $490
- 3 · [Vibe Code Rescue (Lev Arakelyan)](https://whocanfixmyapp.com/companies/vibe-code-rescue-lev-arakelyan) · **9.0**/10 · Best for: A one-off check and a cleanup · From $299

[All 79 companies, ranked](https://whocanfixmyapp.com/directory#ranking)

## Related questions

### My Lovable site is blank on my custom domain but fine on the lovable.app address. Why?

Usually the domain is not finished connecting, or the site was published before the domain was added. Check that Settings, Domains shows Live, then publish again. If it still fails, open the browser console on the custom domain and look for a blocked request.

### Does moving my app to my own host change any of this?

It adds the host's own settings to the list. You must set the environment variables there, add the fallback rule for refreshes, and add the new domain to your auth provider. Lovable's docs say it cannot monitor or debug infrastructure it does not control, so testing is on you.

Sources: [Lovable docs: Hosting and publishing](https://docs.lovable.dev/features/hosting); [Lovable docs: Deploying and hosting outside Lovable](https://docs.lovable.dev/tips-tricks/external-deployment-hosting); [Replit docs: Development and production databases](https://docs.replit.com/features/data-and-storage/development-and-production); [Replit docs: About Deployments](https://docs.replit.com/hosting/deployments/about-deployments).

**Related**

- [Claude Code or Cursor app works on localhost, breaks in production](https://whocanfixmyapp.com/problems/claude-code-works-on-localhost-breaks-in-production)
- [Lovable app not working: what breaks between preview and production](https://whocanfixmyapp.com/problems/lovable-app-not-working)
- [Base44 app not loading or stuck on Thinking: what it usually means](https://whocanfixmyapp.com/problems/base44-app-not-loading)
- [How do I export my app from Lovable and keep building elsewhere?](https://whocanfixmyapp.com/questions/how-to-export-my-app-from-lovable)

**Run every check**

The [production checklist](https://whocanfixmyapp.com/checklist) has all 24 checks with a verdict.
