ApplicationInsights-JS icon indicating copy to clipboard operation
ApplicationInsights-JS copied to clipboard

TypeError: Cannot read properties of undefined (reading 'properties')

Open ranishstha opened this issue 2 years ago • 2 comments

AI: 64 message:"One of telemetry initializers failed, telemetry item will not be sent: TypeError" props:"{exception:[object Error]{ stack: 'TypeError: Cannot read properties of undefined (reading 'properties')\n at http://localhost:60016/main.js:30818:48\n at _self. [as processTelemetry] (http://localhost:60016/vendor.js:13323:135)\n at _callProcessTelemetry (http://localhost:60016/vendor.js:12771:121)\n at http://localhost:60016/vendor.js:12736:30\n at doPerf (http://localhost:60016/vendor.js:12336:10)\n at _processChain (http://localhost:60016/vendor.js:12727:65)\n at Object._processTelemetry [as processTelemetry] (http://localhost:60016/vendor.js:12775:14)\n at Object._processNext [as processNext] (http://localhost:60016/vendor.js:12559:135)\n at BaseTelemetryPlugin._self. [as processNext] (http://localhost:60016/vendor.js:8308:116)\n at _self.processTelemetry (http://localhost:60016/vendor.js:160:23)', message: 'Cannot read properties of undefined (reading 'properties')', name: 'TypeError'}"

ranishstha avatar Mar 21 '23 09:03 ranishstha

This exception is coming from one of your telemetry initializers.

You are referencing the properties property from the event, however, for the event that is being processed the parent of the this object does not contain the properties.

You need to be aware that a telemetry Initializer is called for every event that passed through the system and not all events have all of the properties. I'm guessing that this is probably an exception event as they tend to be rare and don't contain the event.data (which is where I'm guessing you are attempting to access the properties from). ie. event.data.properties.

MSNev avatar Mar 21 '23 15:03 MSNev

This Issue will be closed in 30 days. Please remove the "Stale" label or comment to avoid closure with no action.

github-actions[bot] avatar Jan 16 '24 07:01 github-actions[bot]