From ef9ba4509a0dfc7b43df3f0f5bbedf78d6de8327 Mon Sep 17 00:00:00 2001 From: Anthony Shew Date: Wed, 21 Sep 2022 18:13:54 -0700 Subject: [PATCH] Fix: Contentful webhook body parse. (#40732) ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md) --- examples/cms-contentful/pages/api/revalidate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/cms-contentful/pages/api/revalidate.js b/examples/cms-contentful/pages/api/revalidate.js index 8b3b73924f1ec..a4cf828e518fa 100644 --- a/examples/cms-contentful/pages/api/revalidate.js +++ b/examples/cms-contentful/pages/api/revalidate.js @@ -14,7 +14,7 @@ export default async function handler(req, res) { } try { - let postSlug = req.body.fields.slug['en-US'] + let postSlug = JSON.parse(req.body).fields.slug['en-US'] // revalidate the individual post and the home page await res.revalidate(`/posts/${postSlug}`)