BreakAlarmLog in

Bolt app sign-up works in preview but breaks after deploy

This is usually not a bug in the sign-up form. After a Bolt app leaves the preview, sign-up fails most often because the Supabase Site URL and Redirect URLs still point at localhost or the preview, because the host is missing VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY, or because a profiles insert is blocked by row-level security when Confirm email is on and the session is still null. The live page can load, and the Bolt preview can keep working, while every new account on the deployed domain dies in one of those three places.

Last updated Nov 17, 2026.

A two-minute check

Do this on the live site before you change settings. The preview can stay green the whole time.

  1. Open the deployed URL in a private window. A session from the Bolt preview hides a redirect bug.
  2. Sign up with an email address that has never been used on this Supabase project. An old account answers a different question.
  3. When the confirmation message arrives, read the link address before you tap it.

If the host is localhost, 127.0.0.1, or the Bolt preview, stop. That link is the bug, and tapping it only finishes sign-up on a machine that is running that host. If the host is your live domain and the path is /auth/callback, open that path on its own. A host 404 there is the rewrite problem further down, not a bad Site URL.

Fix it, in this order

Point Supabase at the live domain

In the Supabase project this app uses, open Authentication → URL Configuration. Preview and production are different origins. Auth will keep working in Bolt while the deployed site is missing from the list.

  1. Set Site URL to the live https origin people should land on, for example https://yourapp.com. Pick the one you actually serve. Do not leave it on http://localhost:3000 or the Bolt preview.
  2. Under Redirect URLs, add that domain with and without www. A wildcard covers the callback and any other path, for example https://yourapp.com/** and https://www.yourapp.com/**. The Redirect URLs guide prefers an exact callback path in production when you know it. Either form has to be on the list. Keep localhost and the preview on the list only if you still want those to work.
  3. Save, then send yourself a new confirmation. An email that already went out keeps the host it was sent with.

If the redirectTo in your code is not on that allow list, Supabase does not send the person there. It uses the Site URL. That is why a correct-looking emailRedirectTo can still produce a localhost link while Site URL is http://localhost:3000. Supabase documents the allow list, the Site URL default, and wildcards in the Redirect URLs guide.

Open the confirmation email template in the same project. If the link is built from {{ .SiteURL }}, the message follows Site URL even when the code passes emailRedirectTo. The same guide says to use {{ .RedirectTo }} in that template when you pass a redirect.

Stop hard-coding emailRedirectTo

Bolt often writes the preview origin into the sign-up call. Search the project for emailRedirectTo, redirectTo, and localhost. The value has to be the origin of the page the person is actually on. Use window.location.origin, plus the callback path if you have one. Do not paste the production domain into the source. The preview and the live site then each redirect to themselves.

Paste this into Bolt’s chat:

Sign-up works in the Bolt preview and breaks on the deployed site. Find emailRedirectTo and any other redirectTo passed to Supabase auth. Replace localhost, 127.0.0.1, and the Bolt preview host with the page's current origin. Use emailRedirectTo: window.location.origin + "/auth/callback". Do not hard-code the production domain. Do not put the Supabase service role key in client code. Do not disable RLS. Show the diff.

Changing the code does not rewrite emails that already went out. Ask Bolt for the diff, and do not accept a change that puts the service role key in client code or turns off row-level security to “make sign-up work.”

Set the production env vars, then redeploy

A Bolt preview can have VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY while the host you deployed to does not. Vite reads those names when it builds. Saving them in the host’s settings does nothing until the next deploy. When Bolt publishes to Netlify, set them in the Netlify site settings. The same two names apply wherever the build runs.

  1. On that host, set VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY to the project where you edited URL Configuration. Use the anon key. The service role key does not belong in a client bundle.
  2. Redeploy. A refresh of the old build still has the old values, including empty ones.
  3. Open the live site, start sign-up, and in the browser network tab look for a request whose host ends in supabase.co. No request means this build still does not have the URL. A request to a different project than the one you fixed means the URL configuration you changed is not the one this site talks to.

Create the profile only when a session exists

With Confirm email on, sign-up returns a user and a null session. The browser is still anonymous. A client insert into profiles then runs without auth.uid(), and row-level security rejects it. The usual Postgres error is “new row violates row-level security policy.” The auth user can exist while the profile row does not, so the next page looks like a broken sign-up.

  1. Create the profile from a trigger on auth.users. The trigger runs in the database when the user row is created, so it does not need the new person’s session. It does not backfill people who already signed up. Add those rows once in the SQL editor.
  2. Or insert the profile only after a session exists: after the person opens a confirmation link that lands on the live site, or on the first page load where a session is present.
  3. Do not put the service role key in the client to get past the error. Anything prefixed for the Vite bundle is public, and that key bypasses row-level security for whoever reads the page source.
  4. Do not disable RLS on profiles. That lets any visitor insert and read rows.

A 404 on /auth/callback

The confirmation link can name the right host and still fail. A Vite app is a single page. Netlify and other static hosts look for a real file at /auth/callback, do not find one, and return their own 404. The app never loads, so it never reads the token in the URL.

  1. Open the live /auth/callback path in the private window. If you see the host’s 404 page instead of your app, the server needs a rewrite to index.html.
  2. On Netlify, add public/_redirects so the rule ships with the build:
/*    /index.html   200

Redeploy, then open /auth/callback again. You should get the app, not the host 404. The same idea on another static host is a single-page fallback to index.html. The rewrite only gets your JavaScript onto that path. It does not fix a Site URL that still says localhost.

What to tell people who signed up while it was broken

The email they already have still points at the old host. Changing Site URL does not rewrite it. Tell them not to tap that link, and do not ask them to keep trying it.

How to catch it next time

An uptime monitor only tells you the URL responded. It will not catch a broken sign-up. Doing the two-minute check after every deploy works. BreakAlarm automates that walk.

The limits are the ones on the pricing section. What is BreakAlarm is the same description. The same preview-versus-published failure on Lovable is in My Lovable app stopped working. Other write-ups are on Guides. The homepage runs one check of a public URL you are allowed to test. It does not start the schedule.

Run a free check on your app

FAQ

Why does Bolt sign-up work in the preview but break after deploy?

The preview and the live host are different origins. Supabase will only finish sign-up on the Site URL or on a Redirect URL you allowed. Bolt often leaves localhost or the preview host in those fields, and the production build may be missing VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY. The form can look fine while every new account on the live domain fails.

Why does the Supabase confirmation email go to localhost?

The link is built from emailRedirectTo, or from the Site URL when that redirect is not on the allow list. A hard-coded http://localhost:5173, or a Site URL left on localhost, is what the email contains. A template that still prints the Site URL does the same thing. Read the link before you tap it. Set Site URL to the live https domain, allow that domain with and without www, and set emailRedirectTo from window.location.origin.

The live site loads, but the browser never calls supabase.co. What now?

Vite inlines VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY at build time. Values that exist in the Bolt preview are not automatically present on Netlify or another host. Add both on the host, using the anon key, then redeploy. In the network tab, sign-up should request your project's supabase.co host. No request means this build still does not have the URL.

Confirm email is on and the profiles insert fails. Should I turn off RLS?

Leave RLS on. With Confirm email on, signUp returns a user and a null session, so a client insert runs as anon and a policy that checks auth.uid() rejects it. Create the profile from a trigger on auth.users, or insert it only after a session exists. Do not put the service role key in the client. That key bypasses row-level security, and any VITE_ variable is public in the bundle.

Will an uptime monitor catch a Bolt sign-up that broke after deploy?

An uptime check only tells you the URL responded. The homepage can return 200 while confirmation links point at localhost and new accounts never finish. Signing up in a private window after each deploy catches it. BreakAlarm walks the steps you describe and emails a screenshot and a paste-ready fix prompt when they fail.

References

Bolt, Supabase, and Netlify are trademarks of their owners. BreakAlarm is not affiliated with them.