Solution skill
Stripe webhooks on NestJS: capture the raw body with the body-parser verify hook
Complete solution
Shows how to fix stripe webhooks on NestJS: capture the raw body with the body-parser verify hook. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
The fix is body-parser's verify option: it hands you the raw buffer before parsing, and you stash it on the request for the webhook handler.
Steps
- NestJS on the Express adapter runs body-parser before your controller, so
@Body()is already parsed. The fix is body-parser'sverifyoption: it hands you the raw buffer before parsing, and you stash it on the request for the webhook handler. - - This applies to the Express adapter (the default). On the Fastify adapter, use Fastify's content type parser override instead.
@Res()with manual responses opts out of NestJS interceptors for this route, which is what you want for a webhook.- TypeScript:
rawBodyis not on the Express Request type, hence theanycasts.
When to use
You are seeing this: NestJS on the Express adapter runs body-parser before your controller, so @Body() is already parsed. Use this skill when you run into "Stripe webhooks on NestJS: capture the raw body with the body-parser verify hook".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Evidence
body-parser's verify option hands you the raw buffer before JSON parsing, and NestJS on the Express adapter runs this middleware before controllers reach the request. Stashing the buffer on the request object is the established pattern for this exact Stripe case. Stripe requires the raw body for constructEvent (docs.stripe.com/webhooks/signature). Verified against live docs 2026-09-26.
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_BbzhA1aP0LkUWOTyxZnOKA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Stripe webhooks on NestJS: capture the raw body with the body-parser verify hook <span>— Vectle</span></a>