You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My name is Matija, and I’m a frontend developer working on an Adobe Experience Manager project. We are building websites for multiple brands and plan to use Sentry as our primary monitoring tool. However, we have encountered an issue where enabling Sentry on the page causes the video playback to behave unexpectedly—specifically, the play/pause function seems to be triggered twice.
I'm assuming you're talking about the sentry javascript sdk. You will need to include more details of your implementation in order for them to help you quickly. How is sentry being initialized, what kind of project is it, what version are you using.
Hey, thanks for reporting! I've been talking about this based on your support ticket with @rodolfoBee and could fix the issue by moving the script that injects the Sentry loader directly to the <head> section. Not sure if you're comfortable with me sharing your minimal repro publicly (please let me know!). For now, you should get the updated version via the Zendesk ticket.
Also, as @scttcper said, the more information you share about your SDK setup, version, options, app (e.g. framework used), etc. the better we can help you!
Unfortunately I can't share the full repository, only thing I can share is the HTML code snippet that I've sent already to @rodolfoBee. Also, unfortunately it's not an option to inject SDK directly into the head, it needs to be injected and loaded after the video has been loaded and initialised.
We are using Adobe Experience Manager as a Cloud Service, video is loaded through their Dynamic Media Scene7 JS file (also available in the HTML snippet that I've sent before). Since we are just testing the Sentry integration with the current project, we are using trial version, with version 9.xx. Options for initialising Sentry are also provided in the HTML snippet.
I found the issue and this is indeed related to the Adobe player mocking with event listeners in a very weird way. This is because the script registers the click handler of the playPauseButton multiple times. Once initially and then another time (or actually multiple times) when users first hover over the play/pause button. This is generally fine because if you register the same handler twice, it only gets executed once.
Example:
constmyHandler=()=>{console.log('clicked');}myButton.addEventListener('click',myHandler);myButton.addEventListener('click',myHandler);// Console result:// 'click' <-- only once
However, the problem here is that our SDK interjects itself in the middle and on the second call, it makes sure that a patched version of the handler is registered. Since the patched handler no longer has the same identitfy as the original handler, it is added another time. So basically this:
constmyHandler=()=>{console.log('clicked');}myButton.addEventListener('click',myHandler);constpatchedhandler=()=>{console.log('observed a click');returnmyHandler();}myButton.addEventListener('click',myHandler);// Console result:// 'click'// 'observed a click'// 'click'
So now, the handler is registered twice, meaning on one click, both handlers get executed and hence it appears like a double click, starting and pausing the vide.
This also explains why initializing the SDK before the video script solves this issue: At this point, the SDK comes in early enough to already patch the first handler. At this point, it returns the patched handler but marks the original handler as patched. When addEventListener is called for the second time, we don't return another patched handler, but we already see that the original handler was patched, so we return the first patched handler (i.e. same identitiy).
I don't think we can necessarily fix this on the SDK side but you'd rather have to keep this integration disabled. I tried replacing the monkey patch with a Proxy but even proxied functions have a different identity, so no luck.
Note that you shouldn't loose any errors with this integration being disabled. They should still be caught by our globalHandlersIntegration.
@mvuk27 I opened #16412 to add an option to browserApiErrorsIntegration to ensure we don't cause this double invocation. I tried this on your reproduction and can confirm it also fixes the double button click. So once this is released, you can safely use browserApiErrorsIntegration again if you set the option in your Sentry.init call:
Activity
getsantry commentedon May 23, 2025
Auto-routing to @getsentry/product-owners-issues for triage ⏲️
scttcper commentedon May 27, 2025
I'm assuming you're talking about the sentry javascript sdk. You will need to include more details of your implementation in order for them to help you quickly. How is sentry being initialized, what kind of project is it, what version are you using.
Lms24 commentedon May 28, 2025
Hey, thanks for reporting! I've been talking about this based on your support ticket with @rodolfoBee and could fix the issue by moving the script that injects the Sentry loader directly to the
<head>section. Not sure if you're comfortable with me sharing your minimal repro publicly (please let me know!). For now, you should get the updated version via the Zendesk ticket.Also, as @scttcper said, the more information you share about your SDK setup, version, options, app (e.g. framework used), etc. the better we can help you!
mvuk27 commentedon May 28, 2025
Hi @Lms24 @scttcper ,
Unfortunately I can't share the full repository, only thing I can share is the HTML code snippet that I've sent already to @rodolfoBee. Also, unfortunately it's not an option to inject SDK directly into the head, it needs to be injected and loaded after the video has been loaded and initialised.
We are using Adobe Experience Manager as a Cloud Service, video is loaded through their Dynamic Media Scene7 JS file (also available in the HTML snippet that I've sent before). Since we are just testing the Sentry integration with the current project, we are using trial version, with version 9.xx. Options for initialising Sentry are also provided in the HTML snippet.
Here's the HTML code snippet.
html.txt
14 remaining items
Lms24 commentedon May 28, 2025
I found the issue and this is indeed related to the Adobe player mocking with event listeners in a very weird way. This is because the script registers the click handler of the
playPauseButtonmultiple times. Once initially and then another time (or actually multiple times) when users first hover over the play/pause button. This is generally fine because if you register the same handler twice, it only gets executed once.Example:
However, the problem here is that our SDK interjects itself in the middle and on the second call, it makes sure that a patched version of the handler is registered. Since the patched handler no longer has the same identitfy as the original handler, it is added another time. So basically this:
So now, the handler is registered twice, meaning on one click, both handlers get executed and hence it appears like a double click, starting and pausing the vide.
This also explains why initializing the SDK before the video script solves this issue: At this point, the SDK comes in early enough to already patch the first handler. At this point, it returns the patched handler but marks the original handler as patched. When
addEventListeneris called for the second time, we don't return another patched handler, but we already see that the original handler was patched, so we return the first patched handler (i.e. same identitiy).I don't think we can necessarily fix this on the SDK side but you'd rather have to keep this integration disabled. I tried replacing the monkey patch with a
Proxybut even proxied functions have a different identity, so no luck.Note that you shouldn't loose any errors with this integration being disabled. They should still be caught by our
globalHandlersIntegration.mvuk27 commentedon May 28, 2025
Thank you for your response. This seems to solve our issue, at least temporarily. I'll take this with me to Adobe support.
Lms24 commentedon May 28, 2025
@mvuk27 I opened #16412 to add an option to
browserApiErrorsIntegrationto ensure we don't cause this double invocation. I tried this on your reproduction and can confirm it also fixes the double button click. So once this is released, you can safely usebrowserApiErrorsIntegrationagain if you set the option in yourSentry.initcall:Will also update our docs in a bit to document this option.
feat(browser): Add `unregisterOriginalCallbacks` option to `browserAp…
github-actions commentedon May 30, 2025
A PR closing this issue has just been released 🚀
This issue was referenced by PR #16412, which was included in the 9.24.0 release.
feat(browser): Document `unregisterOriginalCallbacks` option in `brow…
feat(browser): Document `unregisterOriginalCallbacks` option in `brow…
feat(browser): Document `unregisterOriginalCallbacks` option in `brow…