From ee2725f5060396cf4d25cd17ea3970a9d6219614 Mon Sep 17 00:00:00 2001 From: Aman Mittal Date: Wed, 2 Feb 2022 22:03:35 +0530 Subject: [PATCH] Update info on how to process webhooks by disabling bodyParser (#33909) Explicitly mention disabling `bodyParser` when processing a webhook request. Uses the "webhook" keyword that becomes searchable in the docs for anyone running a search from the sidebar. It addresses the issue [here](https://github.com/vercel/documentation/issues/71) and [this discussion](https://github.com/vercel/community/discussions/93). ## Documentation / Examples - [x] Make sure the linting passes by running `yarn lint` --- docs/api-routes/api-middlewares.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/api-routes/api-middlewares.md b/docs/api-routes/api-middlewares.md index 7f1b41d398d9..40b15ac2f718 100644 --- a/docs/api-routes/api-middlewares.md +++ b/docs/api-routes/api-middlewares.md @@ -34,7 +34,9 @@ export const config = { The `api` object includes all configs available for API routes. -`bodyParser` Enables body parsing, you can disable it if you want to consume it as a `Stream`: +`bodyParser` is automatically enabled. If you want to consume the body as a `Stream` or with [`raw-body`](https://www.npmjs.com/package/raw-body), you can set this to `false`. + +One use case for disabling the automatic `bodyParsing` is to allow you to verify the raw body of a **webhook** request, for example [from GitHub](https://docs.github.com/en/developers/webhooks-and-events/webhooks/securing-your-webhooks#validating-payloads-from-github). ```js export const config = {