You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
while integarting the @project-sunbird telemetry with the angular 10 application this is the error i am facing
Error:TypeError: Cannot set property 'telemetry' of undefined
Here is the complete stacktrace of the error
index.js:1829 Uncaught TypeError: Cannot set property 'telemetry' of undefined
at index.js:1829
at Object.../../node_modules/@project-sunbird/telemetry-sdk/index.js (index.js:2393)
at webpack_require (bootstrap:84)
at Module.../../dist/infosys-telemetry-lib/fesm2015/infosys-telemetry-lib.js (infosys-telemetry-lib.js:1)
at webpack_require (bootstrap:84)
at Module../src/app/app.component.ts (app-shell.component.ts:42)
at webpack_require (bootstrap:84)
at Module../src/app/app.module.ts (app.module.ts:1)
at webpack_require (bootstrap:84)
at Module../src/main.ts (main.ts:2)
The text was updated successfully, but these errors were encountered:
When this package is used in an environment involving bundlers or in an environment where 'use strict' is enforced, then we will see this error.
The is the code causing the problem:
var Telemetry = (function() {
this.telemetry = function() {};
var instance = function() {};
var telemetryInstance = this;
...
return this.telemetry;
})();
Here, the this value will be set to the global window object when running in a non-strict mode and everything works fine. But when used within a bundler or in strict mode, this is undefined and that results in this error.
You could possibly solve this by avoiding the use of this here, and simply initializing telemetry as a local variable, because the function is anyway not being used as a constructor.
while integarting the @project-sunbird telemetry with the angular 10 application this is the error i am facing
Error:TypeError: Cannot set property 'telemetry' of undefined
Here is the complete stacktrace of the error
index.js:1829 Uncaught TypeError: Cannot set property 'telemetry' of undefined
at index.js:1829
at Object.../../node_modules/@project-sunbird/telemetry-sdk/index.js (index.js:2393)
at webpack_require (bootstrap:84)
at Module.../../dist/infosys-telemetry-lib/fesm2015/infosys-telemetry-lib.js (infosys-telemetry-lib.js:1)
at webpack_require (bootstrap:84)
at Module../src/app/app.component.ts (app-shell.component.ts:42)
at webpack_require (bootstrap:84)
at Module../src/app/app.module.ts (app.module.ts:1)
at webpack_require (bootstrap:84)
at Module../src/main.ts (main.ts:2)
The text was updated successfully, but these errors were encountered: