ApplicationInsights-JS: [BUG] ClickAnalytics throwing errors in console
Having installed the latest applicationinsights-web
and applicationinsights-clickanalytics-js
packages, errors are occurring in the console.
caught TypeError: Cannot read properties of undefined (reading 'core')
Packages and versions installed are;
"@microsoft/applicationinsights-clickanalytics-js": "^3.0.1",
"@microsoft/applicationinsights-web": "^3.0.1",
And a snippet of how I’m installing is;
export const appInsightsPlugin = {
install: (app: App, opts: AppInsightsOptions) => {
const clickPluginInstance = new ClickAnalyticsPlugin()
const clickPluginConfig = {
autoCapture: true
}
const appInsightsConfig = {
...opts.config,
extensions: [clickPluginInstance],
extensionConfig: {
[clickPluginInstance.identifier]: clickPluginConfig
}
}
const appInsights = new ApplicationInsights({
config: appInsightsConfig
})
appInsights.loadAppInsights()
appInsightsPlugin.setupPageTracking(opts, app)
...
This is a Vue3 project - and Application Insights seems to run ok when loading without the Click Plugin.
If this is a mis-configuration - I’d expect an error indicating so, or something else to go on. 😃
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 15
Commits related to this issue
- [BUG] ClickAnalytics throwing errors in console #2075 — committed to microsoft/ApplicationInsights-JS by MSNev a year ago
- [BUG] ClickAnalytics throwing errors in console #2075 (#2077) — committed to microsoft/ApplicationInsights-JS by MSNev a year ago
- [Master] [BUG] The SDK is not limiting the sdkVersion length, which causes the nightly builds to throw error #2079 [Master] Type 'T' does not satisfy the constraint 'IConfiguration' #2065 [Master] [BU... — committed to microsoft/ApplicationInsights-JS by MSNev a year ago
- [Master] [BUG] The SDK is not limiting the sdkVersion length, which causes the nightly builds to throw error #2079 [Master] Type 'T' does not satisfy the constraint 'IConfiguration' #2065 [Master] [BU... — committed to microsoft/ApplicationInsights-JS by MSNev a year ago
- [Master] [BUG] The SDK is not limiting the sdkVersion length, which causes the nightly builds to throw error #2079 (#2081) [Master] Type 'T' does not satisfy the constraint 'IConfiguration' #2065 [M... — committed to microsoft/ApplicationInsights-JS by MSNev a year ago
Ok, I believe I found the issue and it’s caused by the new
onConfigChange
callback when a configuration items is changed which indirectly then causes a new_pageAction
instance to be created which is passedthis
, however, thethis
won’t necessarily be theClickAnalyticsPlugin
instace – it should be_self
@cadriel Ahh, I didn’t notice, what a silly mistake. Thanks!
@antondrozd you’re installing with an incorrect package name, try;
I installed the nightly3 release in my project (both
web
andclickanalytics-js
) and now have new errors;If I drop the
applicationinsights-web
package back to 3.0.1 (but keepclickanalaytics-js
at nightly3) then I see no errors in the console.I assume the server side app insights needs some internal version bump too?