microsoft / ApplicationInsights-JS

Microsoft Application Insights SDK for JavaScript
MIT License
646 stars 237 forks source link

[BUG] `@microsoft/applicationinsights-web`: TypeError: Right side of assignment cannot be destructured #2350

Open jmyrland opened 3 months ago

jmyrland commented 3 months ago

Description

Upgrading @microsoft/applicationinsights-web from 3.1.2 vs 3.2.1, we get the following error only on MAC/OS X devices - when using app insights with React.

TypeError: Right side of assignment cannot be destructured

Rolling back to 3.1.2 fixes this issue.

Steps to Reproduce

Key dependencies for reproduction:

    "@microsoft/applicationinsights-react-js": "17.2.0",
    "@microsoft/applicationinsights-web": "3.2.1",
    "react": "18.3.1",
    "vite": "5.2.11",

Additional context

Add any other context about the problem here.

Karlie-777 commented 3 months ago

Is your application behind firewall? the one major feature added in 3.2.1 is https://github.com/microsoft/ApplicationInsights-JS?tab=readme-ov-file#service-notification

jmyrland commented 3 months ago

IDK, but we're hosting the app in an Azure app service. Might be something there by default.

Seems weird to me that this will cause issues only on Safari? The app works fine on windows using chrome, but throws this error in Safari.

Karlie-777 commented 3 months ago

do you mind trying the following configs for 3.2.1

{
    connectionString: "YOUR_CONNECTION_STRING",
    ...
    extensionConfig: {
            ["AppInsightsCfgSyncPlugin"]: {
                cfgUrl: ""
            }
    }
}

does the Safari still have the same issue?

jmyrland commented 1 month ago

It seems that this magical config fixes this issue 🤯Tested using version 3.3.0.

What does this config do? Will this be patched, or do we need to keep this config?

Karlie-777 commented 1 month ago

This is the new extension https://github.com/microsoft/ApplicationInsights-JS?tab=readme-ov-file#service-notification we added to the web sku. And for users/apps behind firewall, the config need to be set. So you can keep this config for versions >= 3.2.1

MSNev commented 1 month ago

@jmyrland

Will this be patched

  • No, there will not be any patch to remove this capability

do we need to keep this config?

  • If you don't want to allow this capability then yes you will need to keep this configuration to block us.

What does this config do

  • This component was added to allow use some level of control over deployed SDK instances to react to anything that may be causing problems for our consumers without the need for us or the users to re-deploy their applications. So things like, we deployed a version where for a sub-set of users some feature doesn't work we can globally disable that feature.
  • In a future release we will also be providing a user controllable endpoint (or plan to) to let you configure configurations via remotely again without re-deploying, and that will use this same component and rather than using a single "global" endpoint you will be able to configure your own.
jmyrland commented 1 month ago

Ok, so if I understand correctly, this specific config opts out of the feature you mentioned.

Without opting out, our apps are bricked for specific browsers (Safari on Mac OSX, all versions). So that's a deal breaker for us.

iDK if we have a special combination of dependencies causing this or if this is the case for others as well. If so, I would assume you'd get more inquiries about this.

Also, this error was thrown as part of "react router", and did not mention app insights as part of the stack trace, so it might be hard to track down this package as the culprit.

Anyways, opting out of this fixed the issue for us 👍