Skip to content
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

Browser Exceptions (UnHandled) are not tracked by AppInSights : Update needed #413

Closed
shkrishms opened this issue Feb 23, 2017 · 2 comments

Comments

@shkrishms
Copy link

Hi,
I saw that browser exceptions are NOT getting tracked. I vaguely remember this working couple of weeks back though. I tried a couple of ways to initialize ApplicationInsights (See below) and both the times it did not work. I specifically threw an exception from code and that did not get tracked either.

Some observations:

  • Log.traceInfo("e8835311-44c5-418c-8fc8-dbd4b003c5eb",...) works.

  • Log.trackException("e8835311-44c5-418c-8fc8-dbd4b003c5ed",, Error("Testing browser exception")); works

  • throw new Error("Testing Un handled browser exception"); does NOT get tracked.

  • I did not set DisableTrackingException property anywhere.

Below are the ways I tried (separately, not together)
1. Through Import Module:
import { AppInsights } from "applicationinsights-js";
AppInsights.downloadAndSetup({
instrumentationKey: "xxx-xxxxx",
url: "src/ai.0.js"
});
AppInsights.trackPageView();
window.onerror = AppInsights._onerror;

2. Through JavaScript on master page through the below snippet.
<script type="text/javascript"> var appInsights=window.appInsights||function(config){ function i(config){t[config]=function(){var i=arguments;t.queue.push(function(){t[config].apply(t,i)})}}var t={config:config},u=document,e=window,o="script",s="AuthenticatedUserContext",h="start",c="stop",l="Track",a=l+"Event",v=l+"Page",y=u.createElement(o),r,f;y.src=config.url||"https://az416426.vo.msecnd.net/scripts/a/ai.0.js";u.getElementsByTagName(o)[0].parentNode.appendChild(y);try{t.cookie=u.cookie}catch(p){}for(t.queue=[],t.version="1.0",r=["Event","Exception","Metric","PageView","Trace","Dependency"];r.length;)i("track"+r.pop());return i("set"+s),i("clear"+s),i(h+a),i(c+a),i(h+v),i(c+v),i("flush"),config.disableExceptionTracking||(r="onerror",i("_"+r),f=e[r],e[r]=function(config,i,u,e,o){var s=f&&f(config,i,u,e,o);return s!==!0&&t"_"+r,s}),t }({ instrumentationKey:"xxxxxxxxx" }); window.appInsights=appInsights; appInsights.trackPageView();</script>

@KamilSzostak
Copy link
Contributor

KamilSzostak commented Feb 24, 2017

Duplicate of #282. I'll bring up this issue in our next sprint planning and book some time to fix it.

@shkrishms shkrishms changed the title Browser Exceptions (UnHandled) are not tracked by AppInSights Browser Exceptions (UnHandled) are not tracked by AppInSights : Update needed Apr 25, 2017
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants