sentry-javascript: Non-Error exception captured with keys: currentTarget, isTrusted, target, type

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

Sentry Browser CDN bundle

SDK Version

latest

Framework Version

jquery@2.2

Link to Sentry event

https://workstream-is.sentry.io/issues/4086742434/?project=6108198&referrer=jira_integration

SDK Setup


      Sentry.init({
        release: "#{env.SENTRY_RELEASE}",
      });

Steps to Reproduce

No we cannot reproduce it.

Expected Result

No event object should be thrown as error

Actual Result

Weird empty event object is thrown

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 18 (9 by maintainers)

Commits related to this issue

Most upvoted comments

FYI, we have just merged a PR that, while not fully addressing the issues outlined here, should at least help a bit with clearing this up: https://github.com/getsentry/sentry-javascript/pull/8374

With this PR, the error messages should at least be clearer. When an Event is captured by captureException, it will better show what kind of event it is, and if it is an ErrorEvent, it will also show the error message.

What this does not address is why sometimes there is no stack track. TBH I am not quite sure why this is happening, as for non-error exception we should be using a syntethic exception to get some stack trace at least. So this remains open for investigation šŸ¤”

Hey. šŸ˜‰ I was able to debug when this problem occurs. In a situation where ā€œErrorEvent: ResizeObserver loop limit exceededā€ occurs, the event in method ā€œbeforeSendā€ appears as ā€œErrorEvent: Non-Error exception captured with keys: currentTarget, isTrusted, target, typeā€. This may lead to a fix for the problem.

Version: 7.51.2 image

Interestingly, it worked fine in older versions:

Version: 5.30.0 image

Not sure what is going on here, especially since it’s happening in all browsers.

Basically this occurs because something is running throw event in an event listener, and because this is not being an error thrown we can’t get a stacktrace at all.

Perhaps we should just filter these server side tbh.

Hi @SunStupic thanks for writing in!

Unfortunately, I can’t really tell you either where this error is coming from. You mentioned #6199 already and I also think that this is related. Maybe it is also some script that failed to load. Just that it errored instead of throwing a promise rejection. It’s very hard for us to diagnose these issues without a reproduction. Happy to look into it if there’s a way to reproduce this.

If you you don’t want to see this issue, I suggest you use beforeSend to filter it out:

Sentry.init({
  dsn: 'your_dsn',
  // ...
  beforeSend: (event) => {
    const exception = event.exception?.values && event.exception?.values[0]
    if (exception?.value === 'Non-Error exception captured with keys: currentTarget, isTrusted, target, type') {
      return null;
    }
    return event;
  } 
})

@mydea i’m also tracking the same symptom and we’re on sentry saas. what’s the best way for me to privately share an event link?

I sent you an email (got your email from your website, hope it’s the correct one)!