Open VitaliyPotapov opened 1 week ago
Ok, I've just tracked through your provided reproduction THANK YOU VERY MUCH, it was extremely helpful to identify this specific scenario.
The issue lies around in the changes that we have made for "populating" (and exposing) the dynamic config (so this bug has now been here for quite a while 😦 ) and how the snippet "informs" the main SDK that it has already "hooked" the window.onerror
(so that it doesn't do it again)
As we have just released the final (planned) release for this year (because we are just entering the holiday lock down period) and we are limited in our ability to promote SDK versions to production unless they are required for high priority issues, lets start with a way for you to avoid this issue that I have identified.
As a temporary work-around (until we can release a fixed version), you can add the following to the configuration that you pass to the snippet (SDK Loader)
connectionString: " ... Removed ...",
extensionConfig: {
ApplicationInsightsAnalytics: {
autoExceptionInstrumented: true
}
}
This will then populate the (internalish) flag that the snippet uses to inform the sdk that it has already hooked the onerror, into the location that the SDK is now looking at.
I'll add some more "fix" notes in a follow up comment as I have to run to a meeting right now.
As part of fixing this the core SDK needs to either
core
config for the autoExceptionInstrumented
on the following line, it should use both the core
and _extConfig
https://github.com/microsoft/ApplicationInsights-JS/blob/d4a4d00283cc5686e360189b1975e26d1bc362d4/extensions/applicationinsights-analytics-js/src/JavaScriptSDK/AnalyticsPlugin.ts#L707fb
definition (see the existing usage for the Cookie Cfg)Or a combination of the above, there may also be other alternative solutions that I have not yet identified.
Thanks for the reply and the workaround. I confirm it works!
Description/Screenshot When using appInsights as a snippet, unhandled exceptions are reported twice.
Screenshot:
Steps to Reproduce
/track
and check the payloadExpected behavior Only one unhandled exception is reported.
Additional context