[BUG] TypeError: Cannot read properties of null (reading '0')
In Outlook, from telemetry we are seeing hundreds of thousands of errors a week "TypeError: Cannot read properties of null (reading '0')" with callstack
webpack://owa/node_modules/@microsoft/1ds-post-js/dist-es5/HttpManager.js sendType 536 webpack://owa/node_modules/@microsoft/1ds-post-js/dist-es5/HttpManager.js _canSendPayload 456 webpack://owa/node_modules/@microsoft/1ds-post-js/dist-es5/PostChannel.js sendType 482 webpack://owa/node_modules/@microsoft/1ds-post-js/dist-es5/PostChannel.js _sendEventsForLatencyAndAbove 518 webpack://owa/node_modules/@nevware21/ts-utils/build/es5/mod/funcs/funcs.js apply 68 webpack://owa/node_modules/@nevware21/ts-utils/build/es5/mod/timer/timeout.js fnApply 20
It looks like we are calling sendEventsForLatencyAndAbove even though _httpManager is not initialized.
Which version are you using?
As this is an internal function, it's only triggered (or should) via a timer when it has added items to be batched (which only occurs after everything has been initialized successfully) and the httpManager is created at the point of construction and also initialized as part of the SDK / post channel.
The only possible scenarios I can possible spot where it's currently possible to cause this to be called via a timer are
- You have called the
unload()function which tears down the SDK (But I don't believe that Office is using this) and this generally flushes the queues and stops all timers. - You are calling
flush()but the SDK is not initialized <-- I suspect this is the case. While we provide the flush() function for some edge cases we don't recommend that anyone call it unless we have discussed and not found some other solution.- This is currently not checking if the SDK has been initialized so this "seems" like the most likely scenario, and based on the line number 518, this is "close" to where the current version of the SDK's
flush()function is located. - So either please check if the SDK is initialized
sdk.isInitialized()first or just don't callflush()as we handle all of the page unload events and effectively call this internally in response to the page navigating away.
- This is currently not checking if the SDK has been initialized so this "seems" like the most likely scenario, and based on the line number 518, this is "close" to where the current version of the SDK's
This Issue will be closed in 30 days. Please remove the "Stale" label or comment to avoid closure with no action.