Next.js Discord

Discord Forum

Get raw body next js 13 app directory

Answered
German Spitz posted this in #help-forum
Open in Discord
German SpitzOP
I am trying to secure a GitHub webhook, and for that I need the raw body of the request. In the pages directory this is supposed to work:
export const config = {
  api: {
    bodyParser: false,
  },
};

Error: export const config in ... is deprecated. Please change runtime property to segment export config. See https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config

What is the equivalent to this in the app directory?
Answered by European sprat
const textBody = await request.text()
View full answer

4 Replies

European sprat
use await request.text()
European sprat
const textBody = await request.text()
Answer
German SpitzOP
👍