Description
openedon Oct 12, 2023
Environment:
OS: NixOS 23.05 (Linux)
Node: 18.17.1
applicationinsights version: 2.9.0
After upgrading the applicationinsights
package in my project from 2.7.3
to 2.8.0
and then to 2.9.0
when running my NodeJS application using the APPLICATIONINSIGHTS_CONNECTION_STRING
variable as done prior to 2.8.0
I get the warning:
[1] ApplicationInsights:Invalid JSON config file: [
[1] SyntaxError: Unexpected end of JSON input
[1] at JSON.parse (<anonymous>)
[1] at r._loadJsonFile (/home/keanu/Documents/Development/redacted/dist/redacted.js:2:5417)
[1] at new r (/home/keanu/Documents/Development/redacted/dist/redacted.js:2:4957)
[1] at r.getInstance (/home/keanu/Documents/Development/redacted/dist/redacted.js:2:5038)
[1] at /home/keanu/Documents/Development/redacted/dist/redacted.js:7:72232
[1] at /home/keanu/Documents/Development/redacted/dist/redacted.js:1:263
[1] at /home/keanu/Documents/Development/redacted/dist/redacted.js:12:32841
[1] at /home/keanu/Documents/Development/redacted/dist/redacted.js:1:263
[1] at /home/keanu/Documents/Development/redacted/dist/redacted.js:43:26129
[1] at /home/keanu/Documents/Development/redacted/dist/redacted.js:1:263
[1] ]
the warning is not present during build and goes away if i provide the applicationinsights.json
however this functionality looks to be opt-in via the APPLICATIONINSIGHTS_CONFIGURATION_FILE
variable which I've not set.
When the application is running after the warning, the live metrics page doesnt load and reports no telemetry is being received, this works again as expected when downgrading to 2.7.3
.
My application insights initialisation looks like the following:
applicationInsights.setup()
.setSendLiveMetrics(true)
.setAutoCollectConsole(true, true)
.setAutoCollectDependencies(true)
.setAutoCollectExceptions(true)
.setAutoCollectHeartbeat(true)
.setAutoCollectPerformance(true)
.setAutoCollectPreAggregatedMetrics(true)
.setAutoDependencyCorrelation(true)
.start();