Skip to content
FirstUser

For builders shipping this week

Bolt signup works in the preview but fails on Netlify

FirstUser signs up on your published Bolt app like a brand-new visitor and reports which step failed. A failed step includes a screenshot, a plain-English diagnosis, and a fix prompt you can paste into Bolt, Lovable, Cursor or Replit. Run a free signup test — no account, no card.

In Bolt's preview, the app runs on a dev server that can see your local .env file and serves the app for paths that are not files. You are often the only account that has been used there. The Netlify site is a static build: it only has the environment it had at build time, and without a rewrite it only serves files that exist in the publish folder. A first visitor also has no preview session.

These five checks cover the usual reasons a Bolt signup (Vite, React, and Supabase) works in the preview and fails on Netlify. Checkout is a separate path: Test a Bolt app checkout. A Cursor app on Vercel is a different setup: Login works on localhost but not on Vercel.

1. Blank page or "supabaseUrl is required": the VITE_ variables never reached the build

The live site can be a white page, and the browser console can show an error such as supabaseUrl is required. Or the page loads and the signup button does nothing.

Bolt can keep keys in a local .env for the preview. Netlify's environment variable docs say that when you build on Netlify, the build system does not read .env files. A file that stays only on your machine is not in that build. If you did commit a .env, Vite can still load it, because Vite reads .env files itself. Prefer Netlify's variables: Vite gives environment variables that already exist when the build starts priority over .env files.

Vite's env guide exposes names that start with VITE_ on import.meta.env, and replaces those references when it builds. An empty import.meta.env.VITE_SUPABASE_URL is a common way to reach the blank page.

Fix:

  • In Netlify, open Site configuration → Environment variables and add every VITE_ name the code reads, spelled the same way. A Supabase app often needs VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY (or the publishable key, if that is what the code reads).
  • Build and deploy again. Netlify says additions take effect after you build and deploy. Reloading the current site does not rebuild the JavaScript.
  • Vite says VITE_ values are bundled into client code, so they should not hold secrets. The Supabase URL and the anon or publishable key are client keys. A Stripe secret, an OpenAI key, or the Supabase service role key belongs in a server or Netlify function, not in a VITE_ variable.

2. "Page not found" on /auth/callback, /dashboard, or after refresh

The home page can work, and clicks inside the app can work, while a direct open of the confirmation link, the OAuth callback, or a refresh of /dashboard shows Netlify's own "Page not found". The callback page can 404 before the app stores a session.

A Bolt React app is usually a single-page app: one index.html, and the router draws the other URLs in the browser. Netlify serves files that exist. A request for /auth/callback has no file of its own.

Fix: Netlify's rewrite docs use a 200 rewrite so the address bar stays put while index.html is served. Put this in public/_redirects (no file extension). Vite copies public/ into the build output. When Netlify publishes dist, a _redirects file left at the project root is not in that folder.

/*    /index.html   200

Keep the status at 200. A redirect status would change the address away from /auth/callback. The same rule in netlify.toml is the other form Netlify documents:

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200

3. The confirmation link opens localhost or the Bolt preview

Signup can succeed and the email can arrive, while the link opens localhost:3000, a Bolt or StackBlitz preview address, or a page without a session.

If the app does not pass its own emailRedirectTo, Supabase uses the Site URL from Authentication → URL Configuration. Redirect URLs is the allow list. Set the Site URL to the live https address (https://your-site.netlify.app or your custom domain). Add the Netlify address and the custom domain, including the callback path, for example https://yourapp.com/auth/callback. www and the bare host are different entries. A ** wildcard matches across slashes. A single * does not. Take localhost and the preview off the Site URL. The English detail is password reset or magic link opens localhost, and the shorter German note is Der Bestätigungslink, der auf localhost zeigt.

Also search the code for redirectTo or emailRedirectTo set to localhost or the preview. That value is what the email uses instead of the Site URL, and it still has to be on the allow list. If the link arrives and then says it expired, that is a different failure: Email link is invalid or has expired.

4. Google or GitHub sign-in fails only on the live site

"Sign in with Google" can work in the preview and then show redirect_uri_mismatch, or return to the login page, on Netlify. The live address still has to be on Supabase's Redirect URLs (check 3). For your own Google OAuth client, the callback Google was asked to use has to be an authorized redirect URI. Supabase's usual project callback looks like https://<project-ref>.supabase.co/auth/v1/callback. If Google's error page shows a different redirect_uri, copy that value. www and the bare domain are different addresses. The same checks are written up in Lovable Google login not working, and they apply to a Bolt app on Supabase as well.

5. Test it like a stranger, not like the builder

Your own browser can still have the preview session and an account that already exists. Open the Netlify URL in a private window, sign up with an address you have never used, open the email link, log out, log in again, and refresh a deep page such as /dashboard. Watch the browser console and Supabase's Auth logs while you do it.

Let FirstUser do step 5 for you

FirstUser opens your published URL as a new visitor, signs up with a fresh identity, opens the confirmation email when it can, logs in, tries one action, and opens checkout. If a step fails, you get the screenshot, the error it saw, and a fix prompt you can paste into Bolt.

Run a free signup test·Daily checks from $19/month: Pricing

FAQ

I added the variables in Netlify and the site is still blank. Why?

Vite bakes VITE_ values in at build time. Reloading the current deploy does not rebuild that bundle. Trigger a new deploy. If a cached build still serves the old JavaScript, Netlify's deploy menu includes Clear cache and deploy site.

Is it safe that my Supabase anon key is in the JavaScript?

The anon and publishable keys are client keys. Supabase expects Row Level Security on the tables that key can reach. Do not put the service role key in a VITE_ variable. Vite bundles VITE_ values into the client.

Does this also apply to Vercel?

The VITE_ variables and the Supabase Site URL and Redirect URLs can. Netlify's _redirects file does not apply on Vercel. A common vercel.json rewrite sends /(.*) to /index.html.

My checkout breaks too.

That is a different check. See Test a Bolt app checkout at /test-bolt-app-checkout.

Checklist

Get this checklist by email

We will email this checklist to that address. Privacy policy