Bolt.new Stripe webhook not working after deploying to Netlify (404 or no upgrade)

Updated · by Zane

Where the webhook is supposed to live

Start by separating three things that people lump together: your site, your payment code, and the webhook. Your site is the pages visitors see, and it can be on Netlify. The payment code and the webhook run on a server. In Bolt's built-in Stripe setup, that server is a Supabase edge function.

Bolt's Stripe documentation says the integration creates Supabase edge functions for secure checkout, payment webhook processing and subscription management, and that Bolt automatically handles webhook endpoint registration and signature verification. It also says the integration works with a Bolt database or Supabase for its edge functions. Bolt's separate Netlify page adds that Netlify can't host a database or a traditional backend.

So when a webhook returns 404 after you moved to Netlify, the likeliest story is that Stripe is calling an address on your Netlify site where nothing is listening. Netlify serves your pages, not your Bolt server functions.

One caveat. Bolt's page is not consistent about whether the Stripe integration needs Supabase itself or also works with Bolt's own database. Whatever you use, find the real address in the next step instead of assuming it.

Bolt's Stripe setup puts the webhook in a Supabase edge function, not on Netlify. If Stripe calls a Netlify address where no function exists, the answer is a 404 or your site's own HTML page. Run curl against the exact URL saved in Stripe and read the answer.

Step 1: read what Stripe actually sent

  1. Open the Stripe Dashboard and check the test or live switch matches the payment you are chasing.
  2. Open Workbench, then Webhooks, and click your endpoint.
  3. Note the full URL. Then open the Event deliveries tab and click a failed event.

Stripe's documentation says each event shows as Delivered, Pending or Failed, with the HTTP status code of the attempt. It also says a 4xx can mean the URL does not exist (404), or has access restrictions (401, 403, 405), and that the endpoint must accept a POST. A redirect (302 or any 3xx) counts as a failure too. If the Webhooks list is empty, Bolt's integration may not have registered one for this mode, or you may be looking at the wrong mode.

If the URL is on your Netlify site

A URL such as https://yoursite.netlify.app/.netlify/functions/something is only valid if you have a Netlify function with that name. Netlify's documentation says functions live at /.netlify/functions/<name> by default, unless the function sets its own path, in which case it is available only at that path. Check that the file exists under netlify/functions in your project and was part of the last deploy.

If the URL is on Supabase

Supabase's documentation shows deployed edge functions at https://<project-id>.supabase.co/functions/v1/<name>. Check the project ID is the one your app uses, since a copied address from an old project returns 404 or a different error.

Step 2: check the function and its logs

In your Bolt project, click the database icon at the top, then Server Functions. Bolt's documentation says this lists the server functions in the project, and that View Logs shows the log records, with details for each one. If you use Supabase directly, the Functions section of its dashboard has the same logs.

  • No log lines at all while Stripe shows attempts: the request is not reaching the function. Go back to the URL.
  • Log lines with an error: read the message. A signature or missing-secret message is covered in step 3.
  • The function is missing from the list: it was never created or was deleted. Ask Bolt to recreate the Stripe functions and apply the changes.

A 401 from a Supabase function is worth a special mention. Supabase's documentation says the platform checks a login token before running a function by default, and that signed webhooks from providers such as Stripe, which send no Supabase credentials, need that check turned off and the signature verified inside the function instead. Bolt's integration is meant to set this up itself. If you hand-wrote the function, check it.

Step 3: secrets and test versus live keys

Stripe's test mode and live mode are separate worlds. Each has its own secret key and its own endpoint with its own whsec_ signing secret. Bolt's documentation walks you through a test key that starts with sk_test_, and tells you to use test keys during development. It does not describe the switch to live keys on the page I checked, so do not assume Bolt did it for you.

  • Where secrets live for server functions: Bolt's documentation says to click the database icon, then Secrets. With Supabase on its own, the Edge Function Secrets page does the same job.
  • Netlify environment variables do not reach a Supabase function. They only reach Netlify builds and Netlify functions, according to Netlify's documentation. Adding the Stripe key to Netlify alone will not fix a function that runs elsewhere.
  • Check that the key and the signing secret belong to the same mode as the events. A live payment verified with a test signing secret fails every time.

The detailed version of the signature case is in Stripe webhook signature verification failed, and the version where a price or key does not match is in No such price: test versus live keys.

Step 4: environment variables on the Netlify site

If checkout itself fails on the live site, but the webhook is fine, the problem is the site and not the webhook. Netlify's documentation says that environment variable changes need a new build and deploy to take effect. For a Vite project, the Vite documentation says only variables that start with VITE_ are exposed to the browser code.

  1. In Netlify, open the site, then Site configuration, then Environment variables.
  2. Compare with the .env file of your Bolt project. Every VITE_ value used by the app (your database address and public key, and a Stripe publishable key if one is used) needs to be set here too.
  3. Never put a secret key (sk_) or signing secret (whsec_) in a VITE_ variable. Netlify's documentation warns that embedded values can be read by anyone inspecting the site's files.
  4. Trigger a new deploy after saving, then retest.

Step 5: a redirect rule that swallows the request

Single-page apps on Netlify need a rule that serves index.html for every address, or refreshing a page gives a 404. Netlify's documentation gives /* /index.html 200 as that rule. The effect is that unknown addresses return your home page. If your webhook address is not an actual function, or the rule is applied before your function path, Stripe can receive HTML or an unexpected status instead of your handler's answer.

Netlify's documentation says by default a rewrite cannot shadow a URL that exists, which suggests a real file wins over the catch-all. The documentation I checked does not say the same for function paths. I could not confirm from the documentation how a POST to a path that does not exist is handled, so test it instead of trusting a theory. The same applies to a rule that forces http to https or www to the plain domain: Stripe treats any redirect as a failure.

Terminal
# Send an empty POST to the exact URL saved in Stripe (use your own URL)
curl -i -X POST "https://YOUR-WEBHOOK-URL" -H "Content-Type: application/json" -d "{}"

If the answer is your site's HTML page with a 200, the request is being swallowed and the endpoint does not exist at that address. A 400 with a short message such as "bad signature" is actually good news: the function exists and rejected a fake request. A 404 means nothing is there. A 3xx means a redirect is in the way.

If you do want the webhook on Netlify

You can, but then it is your own code and not Bolt's integration, and the secrets must be set in Netlify with a scope that includes Functions. Netlify's documentation says values in netlify.toml are not available to functions. This is a sketch of the shape, not code taken from Bolt:

Sketch: a Netlify function
// netlify/functions/stripe-webhook.mjs
// Sketch only, not Bolt output. Check names against Netlify's and Stripe's docs.
import Stripe from "stripe";

export default async (req) => {
  if (req.method !== "POST") return new Response("POST only", { status: 405 });

  const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
  const body = await req.text(); // raw text, not req.json()

  let event;
  try {
    event = await stripe.webhooks.constructEventAsync(
      body,
      req.headers.get("stripe-signature"),
      process.env.STRIPE_WEBHOOK_SECRET,
    );
  } catch {
    return new Response("bad signature", { status: 400 });
  }

  // ...update your database here, then answer quickly
  return new Response("ok", { status: 200 });
};

Then register https://your-domain/.netlify/functions/stripe-webhook in Stripe, copy the signing secret it shows into Netlify, redeploy, and send a test event. Pick one place for the webhook, not both, or the same payment will be processed twice.

Test the fix

  1. Stay in Stripe test mode and use a test card. Bolt's documentation lists 4242424242424242 as a successful card.
  2. Pay on the live Netlify site, not the Bolt preview.
  3. In Stripe, open Event deliveries and see a 200 for the event.
  4. In your database, confirm the record changed, then sign in as that customer and check the paid screen.

If the webhook delivers but the customer is still not upgraded, the problem has moved from delivery to your data. See Stripe payment succeeded but the user is still on the Free plan, and for a similar flow on another builder Base44 payment succeeded, user not upgraded.

FAQ

Do I have to register a webhook in Stripe for Bolt's Stripe integration?

Bolt's documentation says no: it states that Bolt handles webhook endpoint registration and signature verification, and that you don't need to configure endpoints in the Stripe dashboard by hand. If you added one yourself pointing at your Netlify site, that is a likely source of the 404.

Can Netlify run the webhook for a Bolt app?

Netlify can run functions, so a hand-written webhook there is possible. But Bolt's documentation says Netlify can't host a database or a traditional backend, and Bolt's own Stripe integration puts payment logic in Supabase edge functions, not in Netlify. Mixing the two is where most of the confusion comes from.

Why does payment work in the Bolt preview but not on my live site?

The preview and the live site can differ in three ways: the keys and secrets they use, the webhook endpoint Stripe is sending to, and the environment variables the live site was built with. Check each one in turn. The sections below take them in that order.

Customers already paid. Do they need refunds?

Usually not. Stripe retries failed deliveries for up to three days in live mode, and you can resend an event from its Event deliveries page once the endpoint is fixed. Stripe's documentation says retries in a sandbox happen three times over a few hours.

Checklist

Still stuck?

Send me the app link and what's broken. The first look is free and you get a fixed quote before I touch anything.

Related guides