Fix your Lovable, Bolt or Cursor app: practical guides

Step-by-step fixes for the problems that show up most in AI-built apps: Supabase RLS, Realtime and schema cache errors, PGRST116 and statement timeouts, Edge Function CORS and 401 errors, auth emails that never arrive or expire, email rate limits, custom domains, Vercel and Netlify deploys (missing output directory, secrets scanning), Replit apps that go idle, slow first loads, and moving off Lovable hosting. Written from real fixes and checked against the official docs.

Lovable · Supabase · RLS

Lovable + Supabase RLS not working: why your data is empty (and how to fix it)

Your Lovable app saves data but the list stays empty, or you get 401/403 errors from Supabase. Here is how Row Level Security causes it and the exact policies that fix it.

Supabase · RLS · Bolt

Fix “new row violates row-level security policy” (Supabase error 42501)

The Supabase insert error 42501 explained: missing INSERT policy, user_id mismatch, insert().select() without SELECT policy, storage uploads. Copy-paste SQL fixes for Lovable and Bolt apps.

Supabase · Security · RLS

RLS is enabled but your Supabase data is still public: how to audit your policies

A green "RLS enabled" check does not mean your data is protected. Two SQL queries to find public tables and USING (true) policies in Lovable, Bolt and Cursor apps, and how to fix them.

Security · Vite · API keys

Exposed API keys in a Vite / React bundle: why VITE_ variables are public and how to fix it

Any VITE_ environment variable is baked into your JavaScript and visible to every visitor. How to check your Lovable, Bolt or Cursor app for leaked OpenAI or Stripe keys, rotate them and move calls to a server.

Supabase · Security · API keys

Supabase service role key exposed in your frontend: what to do right now

The service_role / secret key bypasses Row Level Security. If it is in your Lovable, Bolt or Cursor app's JavaScript, anyone can read and change your whole database. Step-by-step containment and fix.

Lovable · Deploy · Vite

Lovable app shows a blank white page after deploy: causes and fixes

Your Lovable (Vite + React) app works in the editor but shows a white screen on Vercel, Netlify or your own server. Diagnose it from the browser console and fix missing VITE_ env vars, wrong output folder and routing.

Deploy · React · Lovable

Lovable or Bolt app returns 404 on refresh: the SPA fallback for every host

Deep links like /dashboard work when you click but 404 when you refresh or share them. Copy-paste fixes for Netlify, Vercel, nginx, Apache and Cloudflare Pages for React/Vite apps.

Bolt · Netlify · Deploy

Bolt.new deploy failed (or broken) on Netlify: read the log and fix the real error

Bolt.new app works in the preview but the Netlify deploy fails or the live site is broken? Common errors explained: Node version, TypeScript, ERESOLVE, case-sensitive imports, env vars, publish directory.

Supabase · Auth · Lovable

Supabase login redirects to localhost (or the preview URL) after deploy: how to fix it

Magic links, password reset and Google sign-in send users to localhost:3000 or an old preview domain in your Lovable or Bolt app. Fix the Site URL, Redirect URLs, redirectTo and email templates.

Stripe · Supabase · Payments

Stripe webhook not working in a Supabase Edge Function: 401s, signature errors and missing upgrades

Users pay but never get upgraded? Fix Stripe webhooks in Lovable and Bolt apps: JWT verification 401s, "No signatures found" errors, test vs live secrets, raw body, and mapping payments to users.

Security · Headers · Deploy

Missing security headers in your AI-built app: what they do and how to add them

HSTS, Content-Security-Policy, X-Content-Type-Options, frame-ancestors, Referrer-Policy and Permissions-Policy explained in plain English, with copy-paste configs for Netlify, Vercel and nginx.

Security · Checklist · Cursor

Security checklist for AI-built (vibe-coded) apps: 15 checks before you launch

A practical pre-launch checklist for apps built with Lovable, Bolt, Cursor, Replit or v0: database access rules, exposed keys, auth, payments, headers, backups and monitoring, with links to fixes.

Lovable · Supabase · CORS

Lovable + Supabase Edge Function CORS error: why the browser says failed to fetch

Your Lovable app works until you call a Supabase Edge Function, then the console shows a CORS error or Failed to fetch. Here is how to tell a real CORS problem from a crash, and the function pattern that fixes both.

Bolt · Netlify · Environment variables

Bolt.new works in preview but breaks on Netlify: missing environment variables

Your Bolt app is fine in the preview, then Netlify shows a blank page or supabaseUrl is required. Netlify does not inherit Bolt's .env. Here is how to add the right VITE_ variables, rebuild, and keep secrets out of the browser bundle.

Lovable · Supabase · Auth

Supabase auth email not sending in a Lovable app: the SMTP setup that actually works

Signups succeed in your Lovable app but confirmation, magic link, or password reset emails never arrive. The default Supabase sender is for testing. Here is how to add custom SMTP, authenticate your domain, and test with a real external inbox.

Lovable · DNS · Custom domain

Lovable custom domain not working: fix DNS, SSL, and the sign-in redirect

Your Lovable domain stays on Setting up, Needs attention, or the browser shows a certificate error. Copy the exact DNS records from the dashboard, wait for SSL, and add the new URL to your auth settings.

Cursor · Vercel · TypeScript

Cursor app Vercel build failed: fix the error that npm run dev never showed

The app runs in Cursor and fails on Vercel with npm run build exited with 1. The real error is higher in the log: TypeScript, import casing, Node version, or a missing env value. Here is how to reproduce it locally and fix it.

Replit · Deploy · Hosting

Replit deployment keeps sleeping: pick the deploy type that stays awake

Your Replit app is fine while you are in the editor, then the public URL goes cold, times out, or takes forever on the first request. Autoscale can scale to zero. Here is how to tell which deployment type you published and what to change.

v0 · Next.js · shadcn

v0 + shadcn hydration error: stop the server HTML from disagreeing with the client

A v0 or Next.js app with shadcn/ui throws a hydration mismatch on load, often around theme, dates, or random IDs. use client does not turn off server rendering. Here is how to find the first difference and fix it.

Supabase · Storage · Security

Supabase storage bucket public by mistake: close it and switch to signed URLs

A Lovable, Bolt, or Cursor app left a Supabase storage bucket public, so anyone with a link can list or download files. Here is how to flip the bucket to private, add storage policies, replace public URLs, and treat leaked files as exposed.

Lovable · Performance · Vite

Lovable app slow first load: find the huge bundle and cut it down

A Lovable app takes several seconds to show the first screen because the main JavaScript bundle is huge. Measure the download, drop unused libraries and icon packs, lazy-load routes, and fix images so the first visit is usable.

Lovable · Vercel · Netlify

Migrate a Lovable app off Lovable hosting without breaking auth or the database

Take a Lovable app to Vercel, Netlify, or Cloudflare: detect Vite vs TanStack Start, sync Git, set env values, fix SPA or server routing, update auth URLs, and only then move the custom domain.

Supabase · Google OAuth · Lovable

Google Error 400: redirect_uri_mismatch with Supabase: the exact URI to add

Google sign-in in a Lovable, Bolt or Cursor app stops on Error 400: redirect_uri_mismatch. Google needs your Supabase callback URL, not your app URL. Here is how to copy it exactly and where your app URL does belong.

Supabase · RLS · Security

Supabase error: infinite recursion detected in policy for relation

Queries fail with infinite recursion detected in policy for relation (Postgres 42P17). A row-level security policy is looping. Here is how to find the cycle and replace it with a security definer helper, without turning RLS off.

Supabase · Auth · v0

Supabase AuthApiError: Invalid Refresh Token: Refresh Token Not Found

Users of a Lovable, Bolt or v0 app get signed out at random with Invalid Refresh Token: Refresh Token Not Found. Refresh tokens are single use. Here is how to stop a global sign-out, a refresh race or a stale cookie from ending the session.

Vite · Lovable · Bolt

TypeError: Failed to fetch dynamically imported module, after a Vite deploy

A Lovable, Bolt or Cursor Vite app works, then after a new deploy an open tab throws TypeError: Failed to fetch dynamically imported module. The old hashed chunk is gone. Here is the preload error handler and the cache headers that stop it coming back.

Supabase · Grants · Lovable

Supabase "permission denied for table" on a new table: add the missing GRANT

Old tables work, but every new table in your Lovable, Bolt or Cursor app fails with 42501 permission denied for table. Since Supabase stopped auto-granting new public tables, you need an explicit GRANT. Here is the safe fix.

Supabase · Auth · Lovable

Supabase signUp fails with "Database error saving new user": fix the auth.users trigger

New users cannot sign up in your Lovable, Bolt or Cursor app and Supabase returns AuthApiError: Database error saving new user (500). A trigger on auth.users is failing. Find the real error in the logs and fix handle_new_user.

Supabase · Edge Functions · Auth

Supabase Edge Function returns 401 "Invalid JWT": find who rejected the call and fix it

Your Lovable, Bolt or Cursor app calls a Supabase Edge Function and gets 401 Invalid JWT or Missing authorization header. Find out whether the platform or your code sent it, then fix the header, the session or the verify_jwt setting safely.

Supabase · Realtime · RLS

Supabase Realtime not working: the channel says SUBSCRIBED but no changes arrive

Your Lovable, Bolt or Cursor app subscribes to Supabase Realtime postgres_changes, the status is SUBSCRIBED, and no events ever arrive. Check the publication, RLS, grants, the session, filters and React cleanup in that order.

Supabase · PostgREST · Migrations

Supabase "Could not find the table in the schema cache": PGRST205 and PGRST204 explained

Your Lovable, Bolt or Cursor app gets PGRST205 Could not find the table public.x in the schema cache, or PGRST204 for a column. Check the name, the project, the schema, then reload the cache with one SQL line.

Supabase · Auth · SMTP

Supabase "email rate limit exceeded" (429): why signup breaks after two emails and how to fix it

Signup or password reset in your Lovable, Bolt or Cursor app fails with 429 email rate limit exceeded. Learn the three different limits, set up custom SMTP, raise the quota and stop resend loops. Includes exact error codes.

Supabase · Auth · Magic link

Supabase "Email link is invalid or has expired": why the link dies before the user clicks it

Confirmation, magic link or password reset says Email link is invalid or has expired (otp_expired) on the first click. It is usually an email scanner using the link. Fix it with an OTP code or a confirm button.

Netlify · Secrets · Vite

Netlify build fails with "Secrets scanning found secrets in build": tell a public key from a real leak

Your Bolt, Lovable or Cursor app fails on Netlify with Secrets scanning found secrets in build. Find out if the flagged value is a public key or a real leak, then fix it with the right setting and without turning scanning off.

Vercel · Vite · Deploy

Vercel "No Output Directory named dist found after the Build completed": the build worked, the deploy failed

The Vercel log shows your Vite build finishing, then fails with No Output Directory named dist found after the Build completed. Fix the Framework Preset, Root Directory, a stale vercel.json or a renamed outDir for Lovable, Bolt and Cursor apps.

Supabase · Auth · Networking

Supabase "TypeError: Failed to fetch": why login and queries fail before Supabase answers

Your Lovable, Bolt or Cursor app shows TypeError: Failed to fetch or AuthRetryableFetchError on sign in or on a query. Read one line in the Network tab, then fix the wrong URL, paused project, blocker, CORS or aborted request.

Next.js · Vercel · v0

Next.js environment variables undefined on Vercel: NEXT_PUBLIC_, redeploys and "supabaseUrl is required"

Your v0, Cursor or Bolt Next.js app works locally but on Vercel process.env values are undefined, or it crashes with supabaseUrl is required. Fix the prefix, the environment scope, dynamic lookups and the missing redeploy.

Supabase · Database · RLS

Supabase PGRST116 "JSON object requested, multiple (or no) rows returned": what .single() is telling you

Your Lovable, Bolt or Cursor app gets a 406 with PGRST116, Cannot coerce the result to a single JSON object, or JSON object requested, multiple (or no) rows returned. Read the details field, then fix the missing row, the RLS policy or the duplicate.

Supabase · Performance · RLS

Supabase "canceling statement due to statement timeout": why queries die after 3 or 8 seconds

A Supabase query from your Lovable, Bolt or Cursor app fails with code 57014, canceling statement due to statement timeout. Find the slow query, fix RLS policies that run per row, add the missing index, drop exact counts, and raise the limit only where it is needed.