What this thread does
Do first: pass rawBody: true to NestFactory.create() and keep the built-in body parser enabled before checking a Stripe webhook signature.
Short answer
As of November 2026, NestJS 12.6.0, released November 20, documents raw-body support for Express and Fastify (raw body). For No signatures found matching the expected signature for payload, check original bytes, the Stripe-Signature header and this endpoint's secret. Re-serializing parsed JSON changes the signed input (Stripe).
Choose / don't choose
- Express: choose
RawBodyRequest<Request>andNestExpressApplication. - Fastify: choose
RawBodyRequest<FastifyRequest>andNestFastifyApplication; don't copy Express parser options. - Snapshot events: choose
constructEvent()before business processing; don't interpret a signature failure as an event to accept (Stripe).
Not for: Rails subscription retry handling; see ruby-on-rails-subscription-billing-webhook-retries.
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
rawBody | true in application options; exposes req.rawBody as a Buffer | Current Nest Express/Fastify docs | Raw body |
bodyParser | Do not set false; bodyParser: false must not be passed when creating the application | Current Nest docs | Warning |
app.useBodyParser('json', { limit: '10mb' }) | Express example for raising its documented 100kb default; choose the smallest adequate bound | Current Nest Express docs | Size limit |
app.useBodyParser('application/json', { bodyLimit }) | Fastify example uses 10_485_760 bytes; documented default is 1 MiB | Current Nest Fastify docs | Fastify |
Stripe-Signature | Pass the received header with the unmodified body and matching endpoint secret | Current Stripe docs | Signature inputs |
Both useBodyParser() paths respect rawBody. A higher parser limit cannot repair a mismatched signature.
Order of operations
1. Create the app with capture enabled; configure the adapter's parser size before serving requests. 2. At the controller, obtain req.rawBody with the appropriate RawBodyRequest type (Nest). 3. Call constructEvent() with original bytes, header and endpoint secret. On failure, check byte preservation, header presence and endpoint selection; the CLI and Dashboard endpoint secrets are different (Stripe guidance). 4. Only after successful authentication interpret the event and perform side effects. This ordering applies Stripe's instruction to authenticate incoming webhook events (signature errors).
Known failures and fixes
| Error (short quote) | Cause | Fix | Source |
|---|---|---|---|
No signatures found | Wrong signing secret, header or modified body | Compare the three authentication inputs; never reconstruct the body from JSON | Stripe, Jonathan-Hofmann's September 22, 2021 report |
request entity too large | Request body size is larger than the parser limit | Set an appropriate JSON limit; keep capture enabled | Express errors, Nest |
Diagnostic: No signatures found
An absent req.rawBody first calls for a capture/parser check; an available buffer calls for checking its unchanged bytes and endpoint-specific authentication inputs.
Missing
- Minimum Nest and HTTP-adapter versions introducing this feature are not established by the current guide. It supports both adapter paths, not a complete historical compatibility matrix.
- No exact Fastify error text is asserted.
Checked
2026-11-23; NestJS 12.6.0 release and current adapter docs. Sources read: Nest raw body and release, Stripe signature guidance and support, Express parser errors, Jonathan-Hofmann's dated report. No webhook requests were executed.
Started from a post by @NestJS, packaged by the editor. Original post