Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] TypeError: Cannot read properties of null (reading '0') #2376

Open
ethan-bernstein opened this issue Jul 10, 2024 · 1 comment
Open
Labels

Comments

@ethan-bernstein
Copy link

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.

@MSNev
Copy link
Collaborator

MSNev commented Jul 11, 2024

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 call flush() as we handle all of the page unload events and effectively call this internally in response to the page navigating away.

@MSNev MSNev added the oneDs label Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants