Get raw buffer of nodejs request

Is it possible to read raw json as buffer from node request (ctx.req)? I need to validate signature, so parsed variant coming from Strapi does not fit. I’m trying with body-parser library, it seems to work but in the end nothing gets being read (did some debugging). Could it be that stream is already at the end and cannot be read again, or some other issue?

Solution is here

For Strapi 4:

// config/middleware.js
module.exports = [
    name: 'strapi::body',
    config: {
      patchKoa: true,
      multipart: true,
      includeUnparsed: true,

To get raw data:

const unparsed = require("koa-body/unparsed.js");
const rawData = ctx.request.body[unparsed]
1 Like