microsoft / ApplicationInsights-node.js

Microsoft Application Insights SDK for Node.js
MIT License
320 stars 138 forks source link

getCorrelationContext throws TypeError if setup hasn't been called #1217

Closed ryanbecker closed 8 months ago

ryanbecker commented 9 months ago

In version 2.8.0, getCorrelationContext throws a TypeError if setup hasn't been called because defaultClient is undefined:

TypeError: Cannot read properties of undefined (reading 'config')
 at Object.getCorrelationContext (node_modules/applicationinsights/out/applicationinsights.js:180:31)

Looks like this changed here: https://github.com/microsoft/ApplicationInsights-node.js/commit/86a575fa50e821e066f479e7f0df951d974bbb7e#diff-03bc0b0b76f1194643e1681a37204a20ab2b989233cdd55c69682a662ad03425R198

rcbevans commented 9 months ago

Just bumped the package and ran into this. Glad the team is already on top of it. Will roll back for now.