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

Global require overwriting doesn't play nice with applicationinsights 2.5.1+ #685

Closed
CreativeTechGuy opened this issue May 14, 2023 · 4 comments
Labels
Milestone

Comments

@CreativeTechGuy
Copy link

Full details of issue here: microsoft/ApplicationInsights-node.js#1144

Repro steps

Provide the steps required to reproduce the problem:

  1. Use Node.js applicationinsights v2.5.1+ autocollection feature in an Azure Function. Log the return value of appinsights.getCorrelationContext() in the app which will make the problem later easier to see.
  2. Run the Azure Function locally with azure-functions-core-tools
  3. getCorrelationContext() will return null
  4. Downgrade applicationinsights to 2.5.0
  5. getCorrelationContext() will return the expected value

Details

Please see the linked issue above which has a full trace of the problem. This is a problem with multiple packages overwriting globals and not playing nice with each other. Both packages can probably do something to improve the situation and make this sort of issue less likely to occur. Neither package is an issue on its own, but when both try to overwrite the same global in different ways, the issue appears.

@ejizba ejizba added this to the Tracking milestone May 23, 2023
@ejizba
Copy link
Contributor

ejizba commented May 23, 2023

I took a look and commented on the linked issue. This has already been fixed in require-in-the-middle and we just need to wait for the fix to propagate through the dependencies.

As mentioned, the current suggested workaround is to downgrade the applicationinsights package to v2.5.0

@dzoba
Copy link

dzoba commented Aug 24, 2023

I took a look and commented on the linked issue. This has already been fixed in require-in-the-middle and we just need to wait for the fix to propagate through the dependencies.

As mentioned, the current suggested workaround is to downgrade the applicationinsights package to v2.5.0

How do we do this? I don't see applicationinsights in package.json

@ejizba
Copy link
Contributor

ejizba commented Aug 25, 2023

What about in your "package-lock.json" file? Do you see require-in-the-middle or applicationinsights listed?

An easy way to update your dependencies is to run npm update

@ejizba
Copy link
Contributor

ejizba commented Aug 25, 2023

Just tested and this no longer a problem for me with the latest version of applicationinsights

@ejizba ejizba closed this as completed Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants