Open ethan-bernstein opened 4 months ago
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
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.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.
flush()
function is located.sdk.isInitialized()
first or just don't call flush()
as we handle all of the page unload events and effectively call this internally in response to the page navigating away.
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.