Very uninformative onunhandledrejection errors when rejecting with Event
See original GitHub issue- Review the documentation: https://docs.sentry.io/
- Search for existing issues: https://github.com/getsentry/sentry-javascript/issues
- Use the latest release: https://github.com/getsentry/sentry-javascript/releases
- Provide a link to the affected event from your Sentry account
Package + Version
-
@sentry/browser
-
@sentry/node
-
raven-js
-
raven-node
(raven for node) - other:
Version:
5.6.2
Description
Errors captured through onunhandledrejection
mechanism never really provide any useful information that would help in figuring out the problem.
In my app, I have thousands (17K as of now for one of them, after few months) of UnhandledRejection errors. All info that those events provide is just a an error text like UnhandledRejection: "CustomEvent"
(note that with latest version of Sentry it became a little bit more informative with UnhandledRejection: Non-Error promise rejection captured with keys: isTrusted
text). There is no stack nor extra context and those errors happen on routes and paths that work perfectly for me and everyone I know so I’m unable figure out how to address them.
Now, I assume, that the problem is only with unhandled promise rejections that reject with non-Error type like primitive values (string, null, etc.) or (like in this case) an Event object. While I don’t see how to improve cases with primitive values, I think for event objects, more data could be logged.
It seems the UnhandledRejection: Non-Error promise rejection captured with keys: isTrusted
message comes from the fact that isTrusted
is the only iterable key on the event object (try console.log(Object.keys(new CustomEvent('test')))
). But event objects have more useful (non-iterable) keys that could provide more information about the error. Namely I’m thinking about detail
and type
properties. I think those could help identifying from which code event is coming from.
So I’m suggesting to add some custom code (if there isn’t already) for handling that special case (unhandledrejection with event object) better.
Some example events: https://sentry.io/share/issue/4d294f75e9704103b7c3b49e62b6e278/ https://sentry.io/share/issue/c36904ab4c224fbda6f1afff63c106ee/ (these are minimal, sharable versions but full events don’t really provide any other meaningful information either.)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:69
- Comments:74 (15 by maintainers)
Top GitHub Comments
I’m currently receiving thousands of instances of this error from a relatively small number of users. Since I’m just testing out Sentry right now with a free plan, there’s no way to filter them out. Spike Protection also does not seem to react to this issue.
I scheduled better
Event/CustomEvent
handling work for the next week. Will keep everyone posted on this one.@mogelbrod is there a way you can provide a repro-case for this? We never had an issue with TraceKit incorrectly detecting Error instances.
As for your additional enumerables, we have an integration for this – https://docs.sentry.io/platforms/javascript/#extraerrordata
is basically equivalent of your
beforeSend
snippet.