
So I have a POST request which throws an error, but body does not get logged as shown in the image.
The problem is that bugnsag generated the metadata in the middleware instead of the errorHandler. (Don't know why this is done, please don't add overhead and allow application code to run first)
The code over here expects req.body to be an object:
https://github.com/bugsnag/bugsnag-js/blob/7231ea7463e4d3bc63f46f9694fb694eb17fa01f/packages/plugin-express/src/request-info.js#L21
We use body-parser to create req.body into an object, but that middleware is after the bugsnag middleware. (As bugnsag recommends that the first middleware should be the bugnsags over here)
I've moved the bugsnag middleware to be after body-parser for now. But I would ideally like if bugsnag can move the request metadata creation to the errorHandler.
Hi @azizhk
Thanks for the report. We're taking a look and will decide on the best way forward.
Hi @azizhk - we have released a fix for this in v7.2.0.
Most helpful comment
Hi @azizhk
Thanks for the report. We're taking a look and will decide on the best way forward.