Skip to content

feat(browser): Document unregisterOriginalCallbacks option in browserApiErrors integration page #13859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Sentry.init({
requestAnimationFrame: true,
XMLHttpRequest: true,
eventTarget: true,
unregisterOriginalCallbacks: true,
}),
],
});
Expand Down Expand Up @@ -110,3 +111,12 @@ List of default event targets:
- `XMLHttpRequest`
- `XMLHttpRequestEventTarget`
- `XMLHttpRequestUpload`

### `unregisterOriginalCallbacks`

_Type: `boolean`_

Unregister the original `EventTarget.addEventListener` callbacks.
If you experience issues with this integration (or the SDK) causing double invocations of an `addEventListener` callback, set this option to `true`.
This is usually a sign of the SDK being initialized too late in the lifecycle of the page.
If this is the case, you might want to consider initializing the SDK as early as possible to avoid this issue.
12 changes: 12 additions & 0 deletions docs/platforms/javascript/common/troubleshooting/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,18 @@ Remember to pass in `true` as the second parameter to `addEventListener()`. With
</Expandable>
</PlatformCategorySection>

<PlatformCategorySection supported={['browser']}>

<Expandable permalink title="SDK causes double invocations of `addEventListener` (e.g. duplicated click events)">

In very rare cases, the SDK can cause callbacks added via `addEventListener` to an event target (such as a button) to be invoked twice.
This is usually a sign of the SDK being intialized too late in the lifecycle of the page. If you can, try initializing the SDK earlier in your application.

If this is not possible or doesn't apply to your use case, set the `unregisterOriginalCallbacks` option in the [`browserApiErrors` integration](../configuration/integrations/browserapierrors) to `true`.

</Expandable>
</PlatformCategorySection>

<Expandable permalink title="Build errors with vite">

If you're using the [Vite Bundler](https://vitejs.dev/) and a Sentry NPM package, and you see the following error:
Expand Down