Question

Stripe webhook returns 200 on Vercel but nothing happens

Solved · 12 views · asked by kai_makes · edited

Locally with the Stripe CLI everything arrives and my orders row gets updated. Deployed on Vercel the endpoint returns 200 but nothing happens, and Stripe shows no failed deliveries either.

What I’ve tried
  1. Checked the signing secret is the live one
  2. Added console.log at the top of the handler, I see nothing in the Vercel logs
Comment

2 answers

Marked as helpful by the asker
priya_ships · edited

If you see nothing in the logs, the function that returns 200 is not the one you think. Two common causes:

  1. Stripe is still pointing at your old endpoint URL (check Developers → Webhooks, the URL must be the production domain, not a preview URL).
  2. You have both pages/api/webhook.ts and app/api/webhook/route.ts. The old one wins and returns 200 without doing anything.

Also read the body raw before verifying, otherwise the signature check throws:

const body = await req.text()
const event = stripe.webhooks.constructEvent(body, sig, secret)
Comment
jonas_k · edited

And check that the env var exists in the Production environment on Vercel, not only Preview. That one gets me every time.

Comment