-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Description/Screenshot
Uncaught TypeError: Cannot redefine property: pathname
when calling appInsights.loadAppInsights();
Crashes app before react component is rendered, so web page just shows blank. I reproduced this with a simple Vite app, just adding the two app-insights packages and the initialization code below.
Steps to Reproduce
- OS/Browser: MacOS latest version
- SDK Version [e.g. 22]:
"@microsoft/applicationinsights-react-js": "3.4.2",
"@microsoft/applicationinsights-web": "3.0.1",
-
Node version: 18.5.0
-
created app with Vite using react-ts template
-
How you initialized the SDK:
const browserHistory = createBrowserHistory();
const reactPlugin = new ReactPlugin();
const appInsights = new ApplicationInsights({
config: {
connectionString,
distributedTracingMode: DistributedTracingModes.W3C,
enableAutoRouteTracking: true,
extensions: [reactPlugin as unknown as ITelemetryPlugin],
extensionConfig: {
[reactPlugin.identifier]: { history: browserHistory },
},
},
});
appInsights.loadAppInsights();
Expected behavior
no crash, app renders
Additional context
Perhaps this is just incompatible versions of applicationinsights-react-js and applicationinsights-web? If I downgrade applicationinsights-web to 2.8.13, the problem goes away. Still, glad I'm entering this so that the next person who encounters it will see this in a search.
