sentry-javascript: [Bug]
i’ve seen a few discussions regarding <unlabeled event> but the following body seems fine by the looks of it, doesn’t it ?
We are seeing this mostly on the following Client Setup: IE 11.0 Windows (mostly 7)
{
"name": "exception",
"value": {
"values": [
{
"stacktrace": {
"frames": [
{
"function": "?",
"filename": "https://mysvg.de/",
"in_app": true
}
]
},
"value": {}
}
]
}
}
Our Angular 4 ErrorHandler Class:
export class GlobalErrorHandler implements ErrorHandler {
static isErrorOrErrorEvent (wat) {
return Object.prototype.toString.call(wat) === '[object Error]' || Object.prototype.toString.call(wat) === '[object ErrorEvent]';
}
constructor(private injector: Injector) {}
handleError(err) {
const error = err.originalError || err;
if (GlobalErrorHandler.isErrorOrErrorEvent(error)) {
Raven.captureException(error);
} else {
Raven.captureMessage(error.error || error);
}
}
}
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 3
- Comments: 45 (20 by maintainers)
I got around to digging deeper into this, and I think I found the source of the problem.
Where does “unlabeled event” come from?
<unlabeled event>is not something that users are passing, nor is it something that Raven applies. Where does it come from?The answer is the Sentry server:
https://github.com/getsentry/sentry/blob/96bc1c63df5ec73fe12c136ada11561bf52f1ec9/src/sentry/eventtypes/base.py#L38
When handling a
DefaultEventobject, Sentry attempts to get the “sentry.interfaces.Message” property (unsuccessfully) and falls back to the default value:{ 'message': self.data.get('message', '') }Which in turn evaluates to:
{ ‘message': ‘’ }So
message_interfaceis assigned to this object, and on line 36,messageis assigned tomessage_interface[‘message’]— an empty string!In the conditional on line 37, the empty string evaluates to false and
titleis assigned to our old friend,<unlabeled event>.TL;DR — The
DefaultEventis lacking both of the following properties:sentry.interfaces.Messageandmessage. So Sentry uses a stand-in value as the title:<unlabeled event>There’s an error while processing this event. Why?
All unlabeled event errors appear alongside the same message: “There was 1 error encountered while processing this event”.
I believe this is the line responsible for adding the processing error.
The code appears to be casting each property (environment, breadcrumbs, exception, etc.) to a specific format. When the cast fails, it adds a processing error.
What happens next is highly interesting: The raw ‘message’ is coerced to the Sentry message interface:
If the
messageproperty is missing, it defaults toNone, andmsg_strbecomes falsy. Ifmsg_stris falsy, thesentry.interfaces.Messageandformattedproperties are never assigned tomsg_if. As we saw at the beginning of this post, these properties are necessary to preventtitlefrom being assigned to<unlabeled event>.Hypothesis
Raven is sending a bad message object to the Sentry server. Specifically, it is missing the
messageproperty — or themessageproperty is a falsy value, such as an empty string.My guess is that somewhere in the
captureExceptionfunction (here),captureMessageis being passed an empty string for themsgparam. Unfortunately, I can’t figure out which if statement the error falls into because don’t have access to the original error object —and I don’t know how to reproduce it.Solution
We need to make sure to call
captureMessagewith a goodmsgparam. In other words, we should not be passing it an empty string.captureMessageis being called withincaptureException, so it looks like there’s an error type (or object shape) that we are not accounting for there.Released as
3.26.3. Would appreciate a feedback with everyone’s findings.Hey, we are aware of this and updating our react-native SDK to fix this, stay tuned.
After some research, I found that ways to trigger this issue are:
to trigger the exact issue, including mentioned server validation notification,
throw '', but it has to bubble up to the global on-error handler.I’m working on the solution.
We’re also getting this frequently on React Native
@kamilogorek - We have just upgraded from 3.9.1 to 4.4.1 and started to see
<unlabeled event>entries, is there a regression here? We didn’t have any prior to updating.@kamilogorek Any update? This represents a huge number of our inbound exceptions and it’s hard for us to ignore it given we don’t know if it masks real issues or not.
I’m happy to report that upgrading to the latest version of sentry-react-native (1.3.0) seems to have fixed this issue:
(or we fixed something unknowingly in our code…)
We’re still seeing this on our React-Native app even after upgrading to the latest version, getting between 3k and 10k events a day which is eating up a lot of our quota. Is there a way to investigate in more detail?
I’m still seeing a few in 4.4.2, but only from Edge 18. I just updated to 4.6.3, let’s see if this changes anything…
@justinappler @andrew-dixon
4.4.2should fix the issue.unlabeled eventhas totally dropped off for us. Thanks!@kamilogorek Here’s the one we’re seeing: https://sentry.io/crunchbase/client-app-v3-production/issues/364876156/?query=is:unresolved timesSeen:>5
Still seeing this hundreds, sometimes thousands of times per hour but we can’t hide it because don’t know if its a real issue or noise.