Skip to content
Nilay Kabariya

Entry No.107·Fixes··5 min read

Stripe: No signatures found matching the expected signature

Stripe webhook signature errors in Express, Next.js, Hono, Fastify and Workers: which mistake gives which of four messages, and the body that verifies. 30 runs.

by Nilay#stripe#node#express#nextjs#cloudflareFIXED

The error, verbatim

Jump to the fix ↓
StripeSignatureVerificationError: No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe?
If a webhook request is being forwarded by a third-party tool, ensure that the exact request body, including JSON formatting and new line style, is preserved.

Learn more about webhook signing and explore webhook integration examples for various frameworks at https://docs.stripe.com/webhooks/signature

The fix that worked

Pass the raw body: express.raw on the webhook route, before express.json():

app.post('/webhook', express.raw({ type: 'application/json' }), handler);
app.use(express.json());
Not it? Every cause, tested ↓

Tested on

stripe-node
23.2.0 (the current latest)
Frameworks
Express 5.3.0, Next.js 16.4.6 (App Router, dev server), Hono 4.13.20 (Node adapter), Fastify 5.12.8, Cloudflare Workers (wrangler 4.136.2 dev, local workerd)
Node / OS
24.14.0 / Windows 11 Pro, November 22, 2026

Stripe signs the exact bytes it sends. constructEvent computes an HMAC-SHA256 of the timestamp and those bytes with your endpoint secret, and compares it with the stripe-signature header. Any change to the bytes, or the wrong secret, gives the same message: No signatures found matching the expected signature for payload.

So the message alone doesn’t tell you which of the two went wrong. I signed test events the way Stripe does (stripe-node’s generateTestHeaderString, no Stripe account needed) and sent them through five frameworks and twelve direct calls, 30 runs in all. Seven different messages came out; four of them point at the usual mistakes.

Which message means what

Message (start) What I did to get it
No signatures found matching the expected signature for payload body parsed and turned back into a string; CRLF line endings; a secret from another endpoint; an API key as the secret
Webhook payload must be provided as a string or a Buffer passed the parsed object (req.body after express.json(), Fastify’s default parser)
No webhook payload was provided. express.raw() with its default type, while the request says application/json
SubtleCryptoProvider cannot be used in a synchronous context. sync constructEvent on Cloudflare Workers

Two more came up once each: No stripe-signature header value was provided. with the header missing, and No webhook secret value was provided. It should start with `whsec_` with an empty secret. And a valid signature that is too old fails with Timestamp outside the tolerance zone: the default tolerance is 300 seconds.

The body that verifies, per framework

Give constructEvent the raw body as a string or a Buffer, never a parsed object and never JSON.stringify of one:

Framework Failed Passed
Express 5.3.0 express.json() app-wide, before the route express.raw({ type: 'application/json' }) on the route, declared before express.json()
Next.js 16.4.6, App Router JSON.stringify(await req.json()) await req.text(), or Buffer.from(await req.arrayBuffer())
Hono 4.13.20 JSON.stringify(await c.req.json()) await c.req.text()
Fastify 5.12.8 the default JSON parser (req.body is an object) addContentTypeParser('application/json', { parseAs: 'buffer' }, ...)
Cloudflare Workers sync constructEvent await stripe.webhooks.constructEventAsync(...) on await req.text()

For Express, the order is what matters:

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);
  // ...
});
app.use(express.json()); // after the webhook route

Express: two setups that look right and fail

With express.json() app-wide first, adding express.raw() to the route doesn’t help: the JSON parser has already consumed the body, so the route sees an object. That run failed with Webhook payload must be provided as a string or a Buffer.

express.raw() without options only reads application/octet-stream. Stripe sends application/json, so req.body is undefined and the message is No webhook payload was provided. Pass { type: 'application/json' }.

Two other setups passed: express.text({ type: 'application/json' }) on the route, and keeping express.json() app-wide with a verify hook that saves the buffer (verify: (req, res, buf) => { req.rawBody = buf }) and verifying req.rawBody.

Cloudflare Workers: use the async call

On Workers, stripe-node uses Web Crypto, which has no synchronous API, so the sync call can’t work there:

const event = await stripe.webhooks.constructEventAsync(await request.text(), request.headers.get('stripe-signature'), env.STRIPE_WEBHOOK_SECRET);

The same message appears on Node if you pass a SubtleCryptoProvider to the sync call: I got it with Hono on Node too.

When the body is right: the secret

If the body is the raw bytes and the message is still No signatures found, the secret is the next suspect. Each endpoint has its own signing secret, and Stripe’s docs name the wrong endpoint secret as the most common cause. In my runs both of these gave the identical No signatures found message:

  • the secret of another endpoint (whsec_... but not this one);
  • an API key (sk_test_...) passed as the secret.

Copy the signing secret of the endpoint that sends the events, and check the value your code actually reads for a stray newline or space.

What didn’t work

How this was tested

Windows 11 Pro, Node 24.14.0, stripe-node 23.2.0, November 22, 2026. No Stripe account, no real keys and no network calls to Stripe: every event was a made-up checkout.session.completed, invoice.paid, customer.subscription.updated or payment_intent.succeeded object signed locally with stripe.webhooks.generateTestHeaderString and a dummy whsec_ secret, then sent over real HTTP to each framework’s server on localhost. The direct cases called constructEvent with each mistake in turn. Next.js ran as next dev (Turbopack), not a production build, and the Worker ran in wrangler dev with local workerd, compatibility date 2026-09-01 and nodejs_compat, not on Cloudflare’s network. The Stripe CLI (stripe listen) was not used, so its own secret was not tested. The scripts, the placeholder keys and every output file are in nk-repro/stripe-webhook-signature.

— N.K., end of entry No.107

Useful? Pass it on:Post on XFollow @EmotionalMatter

Related entries

  1. No.026

    Fix: Dynamic require of "react" / "fs" is not supported

    esbuild's ES module output throws this for a require() it left in the bundle. Four fixes tested on Node 24, plus the case only Cloudflare Workers hits.

    > throw Error('Dynamic require of "' + x + '" is not supported');

    FIXED3 min
  2. No.066

    Deno Deploy shutdown: move to Workers or Node, tested

    Deno Deploy closes in about six months. I moved a typical Deno Deploy app to Cloudflare Workers and to Node 26: every error, and what fixed each.

    > Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. Received protocol 'jsr:'

    DEPLOY3 min
  3. No.113

    Fix: TS18046 'error' is of type 'unknown' in a catch block

    Why TS18046 appeared after upgrading to TypeScript 6 or 7 with no config change, tested on 5.9.3 to 7.1 beta, and which fixes pass: instanceof, a helper, any.

    > a.ts(1,53): error TS18046: 'error' is of type 'unknown'.

    FIXED3 min

tip: paste the exact error text