Skip to content

For error thrown inside EventProcessor the trace is long and the original error is gone #2716

@jrencz

Description

@jrencz

Package + Version

Version:

5.18.1
First noticed in 5.15.5
Supposedly started in 5.12.4

Description

I recently started experiencing errors like this one: https://sentry.io/organizations/wongapl/issues/1749564756
I reached customer support and they inspired me to find and fix the cause: I had an EventProcessor defined like this:

Sentry.configureScope(function (scope) {
  scope.addEventProcessor(function (event) {
    return event.message.match(/some regex/) ? null : event;
  });
});

Obviously the problem was that not every event has a message and I fixed that. The error is gone.

The issues started when I updated SDK from 5.12.1 to 5.15.5.
I dug through issues and PRs and I think the error thrown in EventProcessor started appearing because of #2416 released in 5.12.4

But my problem I want to report is not that there was an error - that's actually good there was one.

But look into the trace it gives:

TypeError: a.message is undefined
  at ? (/%20line%204454%20%3E%20scriptElement:1:98)
  at executor(../../hub/src/scope.ts:100:24)
  at handler(../../utils/src/syncpromise.ts:30:7)
  at _notifyEventProcessors(../../hub/src/scope.ts:94:12)
  at executor(../../hub/src/scope.ts:106:16)
  at handler(../../utils/src/syncpromise.ts:30:7)
  at _notifyEventProcessors(../../hub/src/scope.ts:94:12)
  at executor(../../hub/src/scope.ts:106:16)
  at handler(../../utils/src/syncpromise.ts:30:7)
  at _notifyEventProcessors(../../hub/src/scope.ts:94:12)
  at executor(../../hub/src/scope.ts:106:16)
  at handler(../../utils/src/syncpromise.ts:30:7)
  at _notifyEventProcessors(../../hub/src/scope.ts:94:12)
  at executor(../../hub/src/scope.ts:106:16)
  at handler(../../utils/src/syncpromise.ts:30:7)
  at _notifyEventProcessors(../../hub/src/scope.ts:94:12)
  at applyToEvent(../../hub/src/scope.ts:344:17)
  at _prepareEvent(../../core/src/baseclient.ts:298:22)
  at _prepareEvent(../src/client.ts:69:18)
  at executor(../../core/src/baseclient.ts:386:12)
  at handler(../../utils/src/syncpromise.ts:30:7)
  at _processEvent(../../core/src/baseclient.ts:385:12)
  at method(../../core/src/baseclient.ts:132:10)
  at _invokeClient(../../hub/src/hub.ts:73:27)
  at captureEvent(../../hub/src/hub.ts:218:10)
  at handler(../src/integrations/globalhandlers.ts:103:20)
  at triggerHandlers(../../utils/src/instrument.ts:101:7)
  at yn/ln.onerror(../../utils/src/instrument.ts:497:5)

There's a lot happening in here - the error goes through SDK multiple times.

I prepared a Pen with this example: https://codepen.io/jrencz/pen/gOPoOjm?editors=0010

The traces the same for latest version and for 5.15.5 I use in prod env right now.
For versions prior to 5.12.4 nothing is sent to Sentry
Since 5.12.4 - the error thrown inside EventProcessor is sent

Another problem is that the original cause that made the EventProcessor run is gone.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions