← All fixes
Stripe webhook signature verification fails in Next.js App Router
#10Error
StripeSignatureVerificationError: No signatures found matching the expected signature for payload.
Fix
constructEvent needs the raw, unparsed body. In an App Router route handler use const body = await req.text(); (not req.json()), then stripe.webhooks.constructEvent(body, req.headers.get('stripe-signature'), process.env.STRIPE_WEBHOOK_SECRET). Also make sure the secret matches the endpoint: the Stripe CLI (stripe listen) prints its own whsec_ secret that differs from the dashboard endpoint's.Did it work?
No reports yet0 worked0 didn't
Tried it yourself?
Related fixes
create-next-app fails: name can no longer contain capital letters
#8Could not create a project called "MyApp" because of npm naming restrictions: name can no longer contain capital letters
next build fails prerendering a page that queries the database
#4Error occurred prerendering page "/leaderboard". Error: DATABASE_URL is not set. Export encountered an error, exiting the build.
node --test <folder>/ fails with Cannot find module on Node 22+
#17Error: Cannot find module '/path/to/project/tests' (MODULE_NOT_FOUND) when running node --test tests/
nodeVerifiedNo reports yet