-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Angular: Sentry.init sends errors without captureException() #2169
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
Dug into this a bit. The Stack Trace seems to indicate that sentryWrapped is the one at: Where there is a captureException at: I am assuming these are coming from the |
Only from |
https://sentry.io/organizations/corridor-dev/issues/1118900329/ |
@AbdealiJK, unfortunately, you use external VPN and source maps are not available. Is there a chance you could upload them? https://docs.sentry.io/platforms/javascript/sourcemaps/ |
same problem here, I reproduced the problem with stackblitz: https://angular-tb2kgw.stackblitz.io. As you open the app there are two buttons: one throw a classical error while the other one throw an error because of a failed http request. The former is sent one, the latter twice! Go into the app.component and update the SENTRY_DSN to reproduce it. This is what I get in the sentry dashboard looks like a captureException is called internally by some helpers, that causes the double error in sentry. I would like to have in sentry only exceptions that I explicitly send, because in my app I have the same/similar event twice |
@Iar0 this is caused by Angular http client using You can either disable this integration completely or if you still want to make sure that your click handlers and other timing APIs are wrapped correctly, filter this specific type of errors. Sentry.init({
integrations(integrations) {
return integrations.filter(i => i.name !== "TryCatch");
}
}); or Sentry.init({
beforeSend(event) {
try {
if (event.extra.__serialized__.error === "ProgressEvent") {
return null;
}
} catch (o_O) {}
return event;
}
}); (this |
@kamilogorek thx! what is exactly the TryCatch integration that you're filtering there? Just to understand what I'm doing if I use that code |
It wraps Whole code can be found here: https://github.com/getsentry/sentry-javascript/blob/master/packages/browser/src/integrations/trycatch.ts |
Hi, I need precision on :
If I well understand, for all Angular project, this integration Thanks for your answer |
It's not useless. It'll just point to one of the frames as it'd come from the SDK, as it wraps the native API. It'll still function just fine. |
I am running into this issue, too. However, the second (more targeted) solution proposed by @kamilogorek doesn't seem to work for me. The event passed into the given callback function doesn't have the |
You won't miss any errors per-se, but you won't have all the metadata that could be possibly extracted (function name for event handlers, event object itself etc.). |
@kamilogorek thank you for the explanation, this is helpful to understand the tradeoffs. |
I have a project where I followed the Sentry angular documentation at:
https://docs.sentry.io/platforms/javascript/angular/
And it worked fine and we were getting errors.
Seemed to work find for 7+ months. Soon as we started getting more users, we noticed that the number of errors in Sentry had increased a lot - a few 10s of thousands more than what we expected.
On debugging, I tried just disabling Sentry and was surprised to see quite a lot of errors still being reported!
I am using Angular 7 with
"@sentry/browser": "^5.5.0",
The error is from a network call that is giving me a unauthorized because some users try to access something they are not supposed to.
We catch these and show them a "Unauthorized" page appropriately. So, I don't want Sentry to report these!
The way we set it up is:
I'm trying to figure out what is reporting these errors.
I see the stacktrace to be from Angular's zone modules. but I haven't configured it to report anything there to the best of my knowledge.
The text was updated successfully, but these errors were encountered: