-
Notifications
You must be signed in to change notification settings - Fork 17
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
Unhandled browser exceptions not being tracked in Angular app #71
Comments
Angular handles all the uncaught exceptions. Try implementing an https://angular.io/api/core/ErrorHandler and call trackException from there. |
Hi I am experiencing the same issue but in my ReactJS application. `<script type="text/javascript">
</script>` Then if I try to throw an exception e.g. throw new Error(), the error is not logged to App Insights. I can get errors appearing if I manually track them with the AppInsights.trackException syntax. |
This issue is affecting us as well. It is also not relegated to Angular as it affects all unhandled exception errors. In the meantime we're going to listen to |
Hello @KamilSzostak , this issue is opened since the 23rd of August. Do you plan to fix it soon? |
@KamilSzostak, we are also impacted by this issue. Appreciate if you can give some info regarding ETA for a fix related to this. |
As it was mentioned before, looks like exceptions are caught by the framework. In order to pass them over to app insights you need have a global error handler and call Using Vue as an example (similar should apply to React and Angular):
This is how error reporting tools like Sentry work. https://github.com/bugsnag/bugsnag-vue/blob/master/src/index.js Curious to know if future appinsights-js v2 will provide Vue, React, Angular adapters out of the box. Thanks everybody! |
There are existing app insights libraries which are built on top of this one that integrate well with the various frontend frameworks, e.g. React and Vue. They are only community supported at this point, so updates may be intermittent and you would need to use their initialization/API surface. However, some work is being done to make the react-appinsights a plugin/adapter for appinsights v2, to give similar behavior to Sentry (same can eventually be done for Vue, Angular). |
Hi, I believe I am seeing the same issue. I'm using ai-web 2.1.0 in a pure JS application (no frameworks). When I throw an uncaught exception, I am not seeing it in the Is it possible that autocollection is off? Is there any way to verify this one way or the other? |
@3xj Can you switch you |
@markwolff Thanks for the quick response. You were correct, my exceptions were not making it to I am still not seeing my |
We patch on top of |
@markwolff Doh -- I missed that fetch tracking was off by default. I've enabled it and am now seeing my calls in the logs. Thanks for your help. |
@3xj what code was that? |
|
We have also added this as an option (thanks to @aaronpowell) in the next release which will be shortly v2.4, we also published this earlier in the month as 2.4-beta to NPM (Not the cdn). Its off by default, but you can enabled by passing enableUnhandledPromiseRejectionTracking = true in the config. |
This Issue will be closed in 30 days. Please remove the "Stale" label or comment to avoid closure with no action. |
Hello,
I am experiencing this issue that was closed/fixed awhile ago: microsoft/ApplicationInsights-JS#282
I created a brand new Angular app using the Angular CLI. Then I made these changes, following this article.
Added a monitoring service:
Added it to my
app.component.ts
:Made a simple button for throwing the exception in my
app.component.html
:Logging a page view works, as does tracking the exception by calling
trackException
. However, I thought all uncaught exceptions would get sent to Application Insights automatically, but I am not seeing any of those show up in the portal. Am I missing something else?I am using these versions:
The text was updated successfully, but these errors were encountered: