question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve reporting of chrome extension errors (and possibly others)?

See original GitHub issue

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

5.10.2, but nothing has changed as of 5.11.0

Description

In certain circumstances, Chrome throws an Extension context invalidated error. Though it’s an actual Error object, including a stacktrace, it wraps that Error object in a CustomEvent with the following structure:

{
  currentTarget: <object>, 
  detail: 
  {
    promise: <object>,
    reason: <the Error object including stacktrace>
  },
  isTrusted: <boolean>, 
  target: <object>, 
  type: unhandledrejection
}

As a result, when it comes through to Sentry, it gets lumped with all other CustomEvent events, under the heading Non-Error promise rejection captured with keys: currentTarget, detail, isTrusted, target. Though the original error and its stacktrace are visible in the Additional Data section of the event details page, the fact that it lives there means it’s not subject to the normal grouping/filtering/etc mechanisms.

In this particular example, that of the Extension context invalidated error, it’s likely that this would always be considered noise, as, unless you are the extension developer themselves, you probably don’t care that your end user happens to be running some third-party extension which has had a problem. In that case, even with the nested structure, these errors can be filtered out using the code mentioned here.

However, it’s an open question whether other, potentially-useful errors also come wrapped up this way, and if this is a common enough occurrence that it’s worthwhile to have the SDK unwrap them automatically, so that they can be treated as full, first-class errors. (In the meantime, code to do this unwrapping manually in beforeSend is attached in a comment below.) Such unwrapping would also allow systems like the server-side “Filter out errors known to be caused by browser extensions” filter to act on this particular error.*

Alternatively (or in addition), we could teach the SDK to always ignore this particular error.

* Note that in order for the server-side filter to catch this error, the Extension context invalidated message would have to be added to the list of known extension errors, but that’s easy enough to do.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

11reactions
JWesorickcommented, Apr 24, 2020

I have a few thousand of these events users in the past few days. I have “Filter out errors known to be caused by browser extensions” turned on. In the last 5 months its been 133k events from only 44 users.

{
  "isTrusted": "[Circular ~]",
  "type": "unhandledrejection",
  "target": "[object Window]",
  "currentTarget": "[object Window]",
  "detail": {
    "reason": {
      "message": "Extension context invalidated.",
      "name": "Error",
      "stack": "Error: Extension context invalidated.\n    at Object._updateMetadata (chrome-extension://haldlgldplgnggkjaafhelgiaglafanh/admin.js:9:165775)\n    at chrome-extension://haldlgldplgnggkjaafhelgiaglafanh/admin.js:9:165593\n    at c (chrome-extension://haldlgldplgnggkjaafhelgiaglafanh/admin.js:9:141164)\n    at E._settlePromiseFromHandler (chrome-extension://haldlgldplgnggkjaafhelgiaglafanh/admin.js:9:113961)\n    at E._settlePromiseAt (chrome-extension://haldlgldplgnggkjaafhelgiaglafanh/admin.js:9:115234)\n    at E._settlePromises (chrome-extension://haldlgldplgnggkjaafhelgiaglafanh/admin.js:9:117079)\n    at u._drainQueue (chrome-extension://haldlgldplgnggkjaafhelgiaglafanh/admin.js:9:74470)\n    at u._drainQueues (chrome-extension://haldlgldplgnggkjaafhelgiaglafanh/admin.js:9:74531)\n    at drainQueues (chrome-extension://haldlgldplgnggkjaafhelgiaglafanh/admin.js:9:72842)"
    },
    "promise": {
      "_receiver0": "[undefined]",
      "_promise0": "[undefined]",
      "_bitField": 136839168,
      "_progressHandler0": "[undefined]",
      "_settledValue": "[Object]",
      "_fulfillmentHandler0": "[undefined]",
      "_rejectionHandler0": "[undefined]"
    }
  }
}
2reactions
esetnikcommented, Jan 30, 2020

@kamilogorek I have “Filter out errors known to be caused by browser extensions” already turned on and still exhausted my quota.

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix "Aw, Snap!" page crashes and other page loading errors
Uninstall unnecessary extensions from Chrome. At the top right, click More More and then More tools and then Extensions. On extensions you don't...
Read more >
Troubleshooting Chrome Web Store violations
Guidelines for understanding why an item was rejected or removed from the Chrome Web Store and how to fix the problem.
Read more >
How to troubleshoot common problems with Chrome Browser
If all else fails, contact the developer of the extension to see if there is a known issue or additional troubleshooting steps are...
Read more >
ignoreErrors not working - #sentry
Improve reporting of chrome extension errors (and possibly others )? ... Review the documentation: https://docs.sentry.io/ Search for existing ...
Read more >
Collect errors from Chrome extension and send report
Why not? · because the extension stops working when an error occurs, javascript in general have that problem, but in developer mode I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found