I am trying to do this in Strapi version 4.12.1, in a custom controller in my plugin, but ctx.request.body[Symbol.for("unparsedBody")]; returns undefined. Here is my function so far:
'use strict';
const crypto = require("crypto");
module.exports = ({ strapi }) => ({
async handle(ctx) {
const secretKey = process.env.SHOPIFY_API_KEY;
const hmac = ctx.request.get('x-shopify-hmac-sha256');
const rawBody = ctx.request.body[Symbol.for("unparsedBody")];
console.log("RAW BODY:", rawBody); // prints RAW BODY: undefined
}});
I have tried to google it, and searched the forum, but I can not find a way to get this to work. Can anyone help?