-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
@sentry/browser - Breadcrumbs Integration click handler falsely implemented? #2125
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
Comments
When I comment out the line |
Found another issue the breadcrumbs introduce. As soon as you use the Breadcrumb integration, every request now runs 4 global |
As mentioned in the first post, there is definitvely a bug here: https://github.com/getsentry/sentry-javascript/blob/master/packages/browser/src/integrations/breadcrumbs.ts#L175 As soon as a click (and probably keypressed) event listener is added via Set your sentry DSN in the index.js file. Then, when clicking "Trigger error", a unhandled error is thrown and caught by sentry. When viewing the error in sentry, you also see a ui.click breadcrumb on the div element which never happened (the first ui.click breadcrumb): If you add more than one event handler, the debouncing seems to limit the number of erroneously generated breadcrumbs to a single one. |
From #2317 (comment), this depends on #2299, which is still open. |
FWIW, this comment from @lobsterkatie with a workaround might be relevant for anyone landing here: #2299 (comment) |
To be clear, that workaround turns off error handling and keeps breadcrumb recording, but it could be adapted to do the reverse (if the goal is to turn off breadcrumb recording entirely). |
This might be the reason why Sentry broke click and other events #2130. Likely this approach is wrapping also another events, and if my code uses a timer to trigger or not events (for example to accept "click" only if executed after less than 100 ms after "pointerdown" event), it will fail do to this Sentry setTimeout. |
Having the same issue. addEventListener always creates a wrong "ui.click" event. It's exactly the same issue as #2197 Not sure if that's related but I also noticed that if an exception is thrown inside a click handler then sentry/browser doesn't send this as a breadcrumb as the breadcrumb seams to be created AFTER the event is send. |
I've been wondering for a while why it seemed like every single Sentry-reported issue seemed to involve the user clicking on a search button: Turns out that it's just that we're calling I'm bemused that this bug has persisted for 17 months without a fix 😕 |
Wow, hard to believe this bug still exists. Here's a temporary workaround we added in the beforeBreadcrumb(breadcrumb, hint) {
// Ignore "ui.click" breadcrumbs that result from "click" event listeners being added
// https://github.com/getsentry/sentry-javascript/issues/2125
if (breadcrumb.category === 'ui.click' && hint && hint.event instanceof Element) {
return null;
}
return breadcrumb;
}, |
@micahjon, Sentry breaks click events #2130 and it was the reason me to moved to @bugsnag/bugsnag-js. |
Just spent a few days trying to track down this issue cause I thought I was going crazy. Thanks for the work around @micahjon - disappointing that a work around is required to have sentry provide accurate information. Edit: To add more info, I'm using nextjs (so react). It appears I'm getting breadcrumbs come through when click events are attached, instead of only when they're triggered. |
@laukstein , as far as I can tell it does fix this issue (#2125) |
Package + Version
@sentry/browser
Version:
Description
I currently investigate why our page is slow and found a lot of
clearTimeout
,setTimeout
calls.There is some pretty weired behavior regarding @sentry/browser and I'm not really sure if this is supposed to be:
Reproduction, just go on any page that has
@sentry/browser
installed and type in the console:Then watch in the debugger what sentry does. It invokes the
breadcrumbEventHandler
inhttps://github.com/getsentry/sentry-javascript/blob/master/packages/browser/src/integrations/breadcrumbs.ts#L163-L165
And then immediately invokes it with the element itself:
This doesn't seem right? Shouldn't this method be called on click and not immediately?
On a page of ours we register ~120 click handler, so this methods debounce is constantly calling setTimeout/clearTimout (that is again shimmed by sentry itself + in our case zone.js/angular) so the call stack and overhead is kinda huge.
The text was updated successfully, but these errors were encountered: