How it worksEngineersResultsPricingFAQBlog
Log inStart for free
How it worksEngineersResultsPricingFAQBlog
Log inStart for free
Loading…

The talent marketplace pairing AI native builders with senior software engineers.

EngineersHow it worksBlogSnapDev for your AIFix a Lovable app

© 2026 SnapDev.ai. Real engineers, on demand.

Terms of ServicePrivacy Policy
Loading…
  1. Home
  2. Guides
  3. Why your vibe-coded app breaks in production (and how to fix it)

Why your vibe-coded app breaks in production (and how to fix it)

Reviewed by Ali Amanat Ali, senior engineer

Last updated 26 November 2026

On this page

  1. Preview vs production, explained simply (why "it worked in preview" means little)
  2. Environment variables and secret keys
  3. Database security rules
  4. Login redirect URLs
  5. Payment webhooks
  6. Custom domains and DNS
  7. Build errors
  8. API keys and CORS
  9. A short pre-launch checklist
  10. When to get help
  11. Frequently asked questions

Your AI-built app works in preview, but the public link shows a blank screen, login fails, or customers cannot save anything. Start by checking what differs between the working environment and the live one, rather than asking the AI to rewrite everything. Platform troubleshooting guides mostly point to settings, connected services and deployment logs.

This guide covers apps built with Lovable, Bolt.new, Replit, and Cursor. The symptoms overlap, but their hosting and settings differ. Use the section matching the failed action, then follow the linked detailed guide where available.

Quick fix

Quick check: open the public link in a private browser window and repeat the one action that fails. If you changed anything since you last published, publish again first. Then use the section below that matches what broke.

Preview vs production, explained simply (why "it worked in preview" means little)

Production is the live version real customers use. Preview is the version you test while building, which may run with different addresses, accounts, settings, or stored data. A working preview proves the app works under those conditions, not every condition customers will encounter.

To deploy means to publish a version to its hosting environment. A build is the preparation step that turns project code into files and server components the host can run. A successful build does not prove login, payments, or database access work after launch.

  1. 1

    Open the live site as a visitor

    Open the public link outside the editor in a private browsing window.

  2. 2

    Record what fails

    Repeat one failing action and record the time and page address.

  3. 3

    Find the stage that failed

    Check whether publishing failed, the app failed to start, or the running app failed during that action.

  4. 4

    Rule out an outage

    Check the platform's status page before changing code if multiple unrelated features suddenly fail.

Lovable publishes a snapshot, so later editor changes need publishing. Bolt.new has Publish and Update controls. Cursor is a coding tool, so identify the actual host used by your project rather than assuming every Cursor-built app has the same publishing settings.

Environment variables and secret keys

An environment variable is a named setting your app reads, such as its database address. A secret key is a private credential that authorizes access to a service. Some variables are public configuration; storing a value as a variable does not automatically make it safe for browser code.

The symptom: the page loads but email, AI features, checkout, or data access fails. Messages may mention a missing value or unauthorized request.

  1. 1

    List what the app needs

    Ask your coding tool for the names of required variables and which need to exist in production. Do not ask it to display secret values.

  2. 2

    Compare with the live host

    Compare those names with the live host's settings, including capitalization and selected environment.

  3. 3

    Keep private values on the server

    Put private values in server-side secret storage, where code runs away from visitors' browsers.

  4. 4

    Deploy again and retest

    Publish a new deployment where required, then repeat the failed action. Vercel and Netlify apply changed variables to new deployments, not an already running release.

On Vercel, check Production rather than only Preview. On Netlify, check the Production context and, where scopes are configured, whether the setting is available to Builds or Functions as needed.

Platform note: Lovable keeps backend Secrets separate from browser-exposed VITE_ values, which go in the project's .env file. Bolt.new Secrets work with server functions. In Replit, check Publishing, then Adjust settings, then Production app secrets, instead of assuming editor values reached the live app. For Cursor projects, configure the chosen host.

Replit's current documentation is not fully consistent about automatic secret syncing. Its Secrets and deployment troubleshooting pages make checking production values the safe instruction.

Database security rules

Database security rules decide which records a visitor may read or change. In Supabase, Row Level Security, or RLS, applies access policies to individual records, while table permissions determine which actions a user role can perform at all.

The symptom: the owner sees records but another customer sees an empty dashboard, or reading works while saving fails. An empty response can be an intentional access filter, not a broken connection.

  1. 1

    Check the database

    Confirm the public app connects to the intended production database.

  2. 2

    Test as a customer

    Test with an ordinary customer account, not just the project owner's administrative tools.

  3. 3

    Name the operation

    Note whether the failure affects reading, creating, changing, or deleting records.

  4. 4

    Inspect permissions and policy

    Ask an engineer to inspect both table permissions and the policy for that operation.

  5. 5

    Fix narrowly, then prove privacy

    Fix the narrow rule, then confirm one account cannot read or change another account's private records.

Warning

Do not turn off RLS or put an administrative database key into the browser to make the error disappear. That can turn an access bug into exposed customer data.

Follow the Lovable Supabase errors guide for deeper diagnosis.

Platform note: these RLS checks apply when your project uses Supabase, including Supabase-backed Lovable and Bolt.new apps. On Replit, the published app uses a separate production database with its own DATABASE_URL, so data you created in development is not there. Cursor projects follow the access system of whichever database you chose.

Login redirect URLs

A redirect URL is the address a login service sends someone to after authentication, meaning it has verified their identity. A live app can still send customers to a preview address if its login configuration was never updated.

The symptom: sign-in returns to the editor, opens an old domain, loops, or reports an address mismatch. Password-reset and email sign-in links can fail even when password login works.

  1. 1

    Open the allowed addresses

    Open your login provider's allowed return-address settings.

  2. 2

    Set the Site URL

    For Supabase, open Authentication, then URL Configuration, and set Site URL to your live HTTPS address.

  3. 3

    Add the redirect URLs

    Add the specific production return paths your app actually uses to Redirect URLs.

  4. 4

    Check the code

    Ask your tool to check the return address requested in the code.

  5. 5

    Test from the live site

    Test a new login, email link, and password reset from the public site.

For social login, also inspect the callback address registered with Google or the other provider. That address may belong to Supabase or another authentication service, not your customer-facing website. Use the callback shown by your authentication provider rather than replacing it blindly.

Platform note: this setup follows the authentication provider, not the AI editor. A custom domain or hosting move can require changes regardless of whether you used Lovable, Bolt.new, Replit, or Cursor. See the Lovable Supabase errors guide for the login settings in detail.

Payment webhooks

A webhook is a message a payment provider sends to your app after an event such as a successful payment. It lets the server confirm what happened even if the customer closes the checkout page.

The symptom: Stripe shows a payment succeeded, but the app still shows a free plan or an unpaid order. Another warning sign is an order activating merely because someone opened the checkout return page.

  1. 1

    Know your setup

    Identify whether your integration uses webhooks, direct payment-status checks, or a managed payments system.

  2. 2

    Find the delivery

    For webhooks, find the affected event in the payment provider's live account and inspect its delivery result.

  3. 3

    Check the destination and secret

    Confirm the destination is the deployed payment handler and that its private signing secret matches the destination.

  4. 4

    Make handling safe

    Ask the engineer to verify the message, update the correct account, and make repeated deliveries safe.

  5. 5

    Test the whole journey

    Test the complete payment-to-access journey using the provider's test environment.

Also check test versus live keys and price identifiers. Use the Lovable Stripe troubleshooting guide for the full sequence. A checkout success page is not payment evidence by itself.

Platform note: Lovable built-in payments manage webhooks, while self-managed Stripe does not use them by default. For custom Bolt.new, Replit, and Cursor integrations, inspect the implementation instead of assuming the same setup.

Custom domains and DNS

DNS, the Domain Name System, directs a web address to the correct hosting service. A custom domain also needs a valid HTTPS certificate, which lets browsers establish an encrypted connection without a security warning.

The symptom: the platform-provided address works, but your own domain does not, opens an old site, or shows a certificate warning. That comparison points toward domain configuration rather than proving the whole app is broken.

  1. 1

    Compare the two addresses

    Open the platform-provided address and your custom domain separately.

  2. 2

    Read the records your host wants

    In the live host's domain settings, read the exact DNS records it requests.

  3. 3

    Compare with your DNS provider

    Compare those records with the company managing your DNS. Check the main domain and www separately.

  4. 4

    Fix only the conflicts

    Correct only conflicting website records, preserving unrelated email records.

  5. 5

    Recheck and wait

    Recheck domain verification and HTTPS status, allowing the provider's documented time for DNS updates.

Avoid repeatedly changing records while networks are still updating. The Lovable custom domain guide covers the focused troubleshooting path.

Platform note: Bolt.new custom domains do not automatically transfer to Netlify when you change hosting. Reconnect the domain on the actual destination host; the same principle applies when moving an exported Lovable or Cursor project elsewhere.

Build errors

A build error prevents the host from preparing the release. That differs from a runtime error, which happens after the app starts, such as a failed request when someone presses Save. Logs are recorded messages that help identify which stage failed.

The symptom: publishing fails, an older version remains live, or the homepage loads but a direct link to another page returns "not found." The last symptom can be a routing issue even when the build succeeded.

  1. 1

    Read the build logs

    Open the failed deployment in your host's dashboard and read its build logs.

  2. 2

    Find the first real error

    Find the first actionable error, not just the final "build failed" line.

  3. 3

    Check the build settings

    Check the selected framework, build command, project folder, and output directory against the actual project.

  4. 4

    Fix that one error

    Ask the tool to fix that error only, including missing packages or incorrectly capitalized file paths.

  5. 5

    Publish and test a deep link

    Publish again, then refresh a page below the homepage to test direct-link routing.

A static site host serves prepared files. It cannot run arbitrary server code unless the chosen hosting product supports it. For a single-page app, where browser code chooses which page to show, the host may need a routing rule that sends page requests to the main HTML file. Do not apply that rule indiscriminately to server-rendered apps or API routes.

Platform note: Replit server apps also need the correct startup command and port settings. Bolt.new documents output-directory and routing fixes, with framework-specific hosting differences. Cursor projects must match their chosen Vercel, Netlify, or other deployment target.

API keys and CORS

An API is the interface apps use to request work or data from another service. An API key identifies or authorizes your app. CORS is a browser rule that blocks requests between different websites unless the receiving server allows them.

The symptom: a feature works in preview but shows "failed to fetch," an unauthorized response, or a CORS message on the live site. These can have different causes, so do not treat every failed request as CORS.

  1. 1

    Open developer tools

    In Chrome, press Ctrl + Shift + I on Windows or Linux, or Command + Option + I on Mac.

  2. 2

    Repeat the failed action

    Select Console for page errors and Network for requests and responses, then repeat the failed action.

  3. 3

    Check the address

    Check the request address for localhost or an outdated preview domain.

  4. 4

    Check the service dashboard

    Check the service dashboard for key validity, required permissions, usage limits, and permitted websites.

  5. 5

    Fix CORS at the server

    If CORS is the cause, configure the receiving server to allow the intended live website, or use a protected server-side function when the service requires a private key.

Warning

Do not disable browser security or expose a secret key as a workaround. A server-side function also needs authentication and usage limits; merely hiding the key does not stop strangers from abusing an unprotected paid feature.

Platform note: a development proxy, which forwards requests during preview, may not exist after publishing. Check the deployed server route in Lovable or Bolt.new, the production endpoint in Replit, or the hosting setup used for your Cursor project.

A short pre-launch checklist

Use this as a practical smoke test, meaning a quick check of essential journeys, not a complete security audit.

  1. 1

    Live release

    Confirm the latest intended release is marked live, then open its public address outside the editor.

  2. 2

    Phone and desktop

    Open the site in a private window on a phone and a desktop.

  3. 3

    Direct links

    Refresh a page below the homepage and confirm it loads directly.

  4. 4

    Production settings

    Check that required production settings exist without displaying their private values.

  5. 5

    Sign-up and sign-in

    Create an ordinary customer account, sign out, and sign back in.

  6. 6

    Email links

    Test email sign-in or password reset if your app offers them.

  7. 7

    Saving data

    Save a record, reload, and confirm it persists in the intended database.

  8. 8

    Privacy

    Use a second account to confirm private records stay private.

  9. 9

    Payments

    Simulate a payment, verify the correct account receives access, and check cancellation behavior.

  10. 10

    Domain and HTTPS

    Test the main domain, www if supported, and HTTPS without certificate warnings.

  11. 11

    Logs

    Find where build logs and running-app logs live, and confirm a failed action produces useful, redacted evidence.

  12. 12

    Recovery

    Record a known-good code version and verify your database backup or recovery plan separately.

When to get help

Get help when the same failure survives several evidence-based attempts, a proposed fix weakens security, or the problem affects money, identity, or customer data. Stop broad automated edits while you preserve the error and identify the affected release.

A rollback can restore service, but only after checking compatibility with current database changes. If the AI repeatedly claims success without passing the original test, follow our Lovable fix-loop guide before approving another round.

SnapDev's live Lovable support connects you with a vetted senior engineer who can inspect code and configuration together on a screen-share. SnapDev also supports founders using Bolt.new, Replit, and Cursor. If the engineer can't solve your problem, you get your hours back.

Frequently asked questions

Why does my app work in preview but not when published?

The published app may use different settings, a different database, new login addresses, or a different build. Compare one failing action across the two environments before changing code.

My deployment succeeded. Why is the page blank?

Success means publishing completed, not that every customer action passed. Check the browser Console and Network panels, then running-app logs for that release.

Do I need to rebuild my AI-generated app from scratch?

Not automatically. Missing configuration, routing mistakes, and incorrect service settings can have targeted fixes. An investigation should establish the cause before recommending a replacement.

Why does the homepage work but refreshing another page gives a 404?

A single-page app may be missing the host's direct-link routing rule. Confirm your app type before adding a rule, because server-rendered pages and APIs need different treatment.

Can I ask the AI to fix production errors?

Yes. Supply the live URL, exact steps, and redacted error evidence, then request one targeted fix. Test the published result yourself, and pause if the fix exposes keys or removes access controls.

Still stuck? Talk to a senior engineer in minutes

Tell us where you're stuck and we match you with a vetted senior engineer who takes it from there.

Get matched with an engineerMore help with Lovable