diff --git a/docs/platforms/javascript/common/configuration/integrations/browserapierrors.mdx b/docs/platforms/javascript/common/configuration/integrations/browserapierrors.mdx index 784a9c8370a8c..1232e96ff1ae5 100644 --- a/docs/platforms/javascript/common/configuration/integrations/browserapierrors.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/browserapierrors.mdx @@ -40,6 +40,7 @@ Sentry.init({ requestAnimationFrame: true, XMLHttpRequest: true, eventTarget: true, + unregisterOriginalCallbacks: true, }), ], }); @@ -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. \ No newline at end of file diff --git a/docs/platforms/javascript/common/troubleshooting/index.mdx b/docs/platforms/javascript/common/troubleshooting/index.mdx index 1a38638b34e52..69ca25fec96b5 100644 --- a/docs/platforms/javascript/common/troubleshooting/index.mdx +++ b/docs/platforms/javascript/common/troubleshooting/index.mdx @@ -389,6 +389,18 @@ Remember to pass in `true` as the second parameter to `addEventListener()`. With + + + + +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`. + + + + If you're using the [Vite Bundler](https://vitejs.dev/) and a Sentry NPM package, and you see the following error: