Pulling my hair out over this. Thanks in advance to anyone who can take a look. Any idea why req.body would be empty? Medusa.JS should be using bodyParser by default, yes? It was working earlier today and now it isn’t. Clearly something has changed and I can’t figure out what. This is my middlewares.ts
file:
async function myTestFunc(req: MedusaRequest, res: MedusaResponse, next: MedusaNextFunction) {
const logger = req.scope.resolve<Logger>('logger');
console.log("Request BODY!", JSON.stringify(req.body))
console.log("Request PARAMS!", JSON.stringify(req.params))
console.log("Customer ID!", JSON.stringify(req.user?.customer_id))
next();
}
export const config: MiddlewaresConfig = {
routes: [
{
matcher: '/store/carts/:id/line-items',
middlewares: [authenticateCustomer(), myTestFunc]
}
],
};
Thanks again, much appreciated.