parse-community / parse-community/parse-server
Repair original enableExpressErrorHandler behaviour
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 21.4k
- Forks
- 4.8k
- Avg merge
- 7h 45m
- Merged PRs (30d)
- 11
Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest version of Parse Server.
Issue Description
This discussion started in https://github.com/parse-community/parse-server/pull/6423#issuecomment-1068110968 so this is a standalone issue where we can discuss this in isolation (most text is just a copy from my original comment).
I stumbled upon PR https://github.com/parse-community/parse-server/pull/6423 since we're currently adopting Sentry error reporting for our backend. To use Sentry's errorHandler middleware we're required to set enableExpressErrorHandler to true. However, after PR https://github.com/parse-community/parse-server/pull/6423 was merged this also mean that the default Parse error handler is basically disabled.
I checked the history and found the PR that introduced this feature from the beginning (https://github.com/parse-community/parse-server/pull/4697). The original intention seems to have been quite different. Instead of replacing the default Parse error handler it just used next to let the error flow through subsequent middlewares, which would be optimal our use-case with Sentry.
So by merging this fix it also seems to have broken the intended behaviour. A way to solve this might be to introduce a "overrideParseErrorHandler" (naming suggestions greatly appreciated) config or similar, and restore the original behaviour.
A workaround is of course to copy the logic from the Parse error handler and use that as a middleware in our own application, but that's not optimal.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the enableExpressErrorHandler entry point and compare the behavior discussed in PRs 6423 and 4697. Trace how Parse's error handler and subsequent middleware interact, then verify that the intended Parse error handling and downstream Sentry middleware flow are both supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- express, javascript, node.js
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100