Bolt.new Works in Preview but Broken on Netlify/Vercel? 3 Fixes (2026)
Bolt.new Works in Preview but Broken on Netlify/Vercel? 3 Fixes (2026)
Bolt.new apps break in production for three reasons: env vars not propagated to the host, Netlify/Vercel build config mismatch, and webhook/OAuth URLs still pointing at the StackBlitz preview. Users put it bluntly: “every new deployment deploys into another universe rather than updating the existing site.” Fix below.
Quick fix for Bolt.new Works in Preview but Broken
Fix 1 — Propagate every env var to your host
In Bolt, open .env. Copy every VITE_* and server-side key.
On Netlify: Site settings → Environment variables → Add variable. On Vercel: Project → Settings → Environment Variables, scoped to Production. Use production Supabase, production Stripe keys, production Resend keys — never the preview values.
Trigger a fresh deploy (don’t just clear cache — re-run the build). Hard-refresh the production URL.
Deeper fixes when the quick fix fails
- 02
Fix 2 — Align build config with your host
For a Vite + React Bolt project, Netlify/Vercel need:
- Build command:
npm run build - Publish directory:
dist - Node version: pin via
.nvmrc(Node 20) - SPA routing: add
public/_redirectswith/* /index.html 200(Netlify) orvercel.jsonrewrite (Vercel)
If assets 404, check
vite.config.ts→base. It should be'/'for a root-domain deploy. - Build command:
- 03
Fix 3 — Repoint every webhook and OAuth redirect
Go through the third-party services the app touches and replace every StackBlitz URL with your production domain:
- Stripe Dashboard → Webhooks: delete preview endpoint, add
https://yourapp.com/api/stripe-webhook, copy the newwhsec_into host env. - Supabase → Authentication → URL Configuration: set Site URL, add redirect variants.
- Google Cloud Console: add production domain to Authorized redirect URIs.
- Any OpenAI / Resend / Postmark webhook: same treatment.
- Stripe Dashboard → Webhooks: delete preview endpoint, add
Still broken after all three?
You’re in the uncommon 15%. Check:
- CORS on a custom serverless function
- Build cache holding stale bundle — clear cache and redeploy
- DNS not propagated — verify with
dig yourapp.com
Why AI-built apps hit Bolt.new Works in Preview but Broken
Bolt.new runs in a StackBlitz WebContainer — a sandbox that auto-wires Supabase, auto-injects env vars, and runs with permissive CORS. Your production host does none of that. Each publish creates a fresh Netlify or Vercel deployment with its own env scope, its own build log, and its own cache.
Industry benchmarks put AI-code vulnerability rates close to half (see our 2026 research). The Bolt preview masks these because it runs inside a trusted sandbox. Production is the first time real browsers, real DNS, and real users meet your code.
“Every new deployment deploys into another universe rather than updating the existing site.”
Diagnose Bolt.new Works in Preview but Broken by failure mode
Open the production URL in an incognito window, open DevTools, and match the error pattern to the table before you change anything.
| Error you see | Root cause | Fix |
|---|---|---|
| Blank page, console: supabaseUrl is undefined | Env vars missing on Netlify/Vercel | Fix #1 |
| 404 on routes that work in preview | SPA redirect missing; wrong publish directory | Fix #2 |
| Stripe/auth callbacks go to StackBlitz URL | Webhook URLs not repointed | Fix #3 |
| CSS missing; assets 404 | Wrong base path in vite.config.ts | Fix #2 |
Related errors we fix
Still stuck with Bolt.new Works in Preview but Broken?
If the three fixes aren’t cutting it, a fixed-price fix ships in days:
- →You've been stuck for >4 hours
- →Each Bolt publish creates a new Netlify site
- →You have paying users on the broken deploy
- →Stripe webhooks aren't landing in production
Bolt.new Works in Preview but Broken questions
Why does Bolt.new work in preview but break on Netlify?+
How do I deploy a Bolt.new Vite app to Netlify?+
Why do my Bolt.new environment variables not work in production?+
What does 'every new deployment deploys into another universe' mean?+
How do I connect Bolt.new to an existing Netlify site?+
Is my Bolt.new production deploy secure?+
Ship the fix. Keep the fix.
Emergency Triage restores service in 48 hours. Break the Fix Loop rebuilds CI so this error cannot ship again.
Hyder Shah leads Afterbuild Labs, shipping production rescues for apps built in Lovable, Bolt.new, Cursor, Replit, v0, and Base44. our rescue methodology.
Bolt.new Works in Preview but Broken experts
If this problem keeps coming back, you probably need ongoing expertise in the underlying stack.