Bugsnag-js: [plugin-express] body not showing up in request tab.

Created on 13 Sep 2019  路  2Comments  路  Source: bugsnag/bugsnag-js

Screenshot 2019-09-13 at 3 13 52 PM

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.

bug released

Most helpful comment

Hi @azizhk

Thanks for the report. We're taking a look and will decide on the best way forward.

All 2 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

foxyblocks picture foxyblocks  路  5Comments

waynebloss picture waynebloss  路  3Comments

livthomas picture livthomas  路  4Comments

antoinerousseau picture antoinerousseau  路  4Comments

mattimatti picture mattimatti  路  4Comments