Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin-express: fetch request body in onError #872

Merged
merged 5 commits into from
Jun 15, 2020

Conversation

imjoehaines
Copy link
Contributor

This fixes an issue where the body may not exist when the request handler runs and so the body will be missing from the error report in the dashboard

This can happen because the body may be parsed by middleware that runs after the requestHandler, which is fairly likely because Bugsnag should be installed as early as possible

See #620 for more details

I tried to write some tests for this but struggled to get anything working. I may be missing something but it seems like it's hard/impossible to test due to how the requestHandler works (happy to be corrected though!)

This fixes an issue where the body may not exist when the request
handler runs and so the body will be missing from the error report
in the dashboard

This can happen because the body may be parsed by middleware that
runs after the requestHandler
@bugsnagbot
Copy link
Collaborator

bugsnagbot commented Jun 1, 2020

@bugsnag/browser bundle size diff

Minified Minfied + Gzipped
Before 39.22 kB 12.11 kB
After 39.22 kB 12.11 kB
± No change No change

Generated by 🚫 dangerJS against 4811928

@bengourley
Copy link
Contributor

I tested this manually and it worked as desired.

I also figured a way to get the maze runner tests to verify this behaviour, so have pushed a test up for that. Tagging @twometresteve for a review from a testing POV.

Copy link
Contributor

@twometresteve twometresteve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from a test perspective.

@bengourley bengourley merged commit 127ffdc into next Jun 15, 2020
@bengourley bengourley deleted the fix-express-request-body branch June 15, 2020 16:40
@bengourley bengourley mentioned this pull request Jul 6, 2020
@tomlongridge tomlongridge linked an issue Aug 14, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[plugin-express] body not showing up in request tab.
4 participants