- Symptom
- No signatures found matching the expected signature for payloadWorks under stripe listen but fails on the deployed endpoint, or the reversereq.body is already an object when constructEvent runs
- Cause
- The signature covers the exact raw bytes Stripe sent, so any middleware that parses or re-serializes the body first, such as app.use(express.json()) registered before the route, breaks it. The other common cause is using the CLI whsec secret in production or a Dashboard endpoint secret locally.
- Fix
- Give the webhook route the raw body and register it before the global JSON parser. In the Next.js App Router read await request.text(). Use the secret that belongs to the endpoint actually sending the event.
- Apply
app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => { const event = stripe.webhooks.constructEvent(req.body, req.headers['stripe-signature'], process.env.STRIPE_WEBHOOK_SECRET); res.sendStatus(200); }); app.use(express.json()); // only after the webhook route- Affected
- stripe-node with Express, Next.js and other body-parsing frameworks, all versions, checked October 2026
- Sources
Last verified 2026-10-15 · Confirmed by 0 builders