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

Node: express: uncaught exceptions sent with 200 status code instead of 500 #510

Closed
hefox opened this issue Mar 29, 2019 · 1 comment
Closed
Labels
released This feature/bug fix has been released

Comments

@hefox
Copy link

hefox commented Mar 29, 2019

Upgrading from the bugsnag 2.x to 6.x and trying to get an express app erroring correctly. Right now when it errors via an uncaught expectation (I added sdfsa.fafsadf; so it threw an undefined error, to a route), it throws a 200 with "Internal server error"

Looking at node js, res.status is how a status code is set, but it's a function https://expressjs.com/en/api.html#res.end

in the bugsnag express code, it's

 res.status = 500
 res.end('Internal server error')

switching it to res.status(500) correctly sends a 500 status code

@bengourley bengourley added the scheduled Work is starting on this feature/bug label Apr 1, 2019
@bengourley
Copy link
Contributor

Thanks for the report. Since we also support Connect using the same middleware, this needs to be res.statusCode = 500 rather than res.status(). I've scheduled a fix.

bengourley added a commit that referenced this issue Apr 2, 2019
The wrong property was being used in attempt to set the HTTP status code. This fixes it for Express
and Connect (connect doesn't have the method res.status()).

Fixes #510.
bengourley added a commit that referenced this issue Apr 2, 2019
The wrong property was being used in attempt to set the HTTP status code. This fixes it for Express
and Connect (connect doesn't have the method res.status()).

Fixes #510.
@abigailbramble abigailbramble added released This feature/bug fix has been released and removed scheduled Work is starting on this feature/bug labels Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released This feature/bug fix has been released
Projects
None yet
Development

No branches or pull requests

3 participants