Cannot read property setZoomJSLib of Undefined

Description

Some users can’t use our application due to the javascript error mentioned below on ZoomMtg object.

This error happen on the following code of lines:

const libPath = `https://dmogdx0jrul3u.cloudfront.net/${meta.sdkVersion}/lib`;
window.ZoomMtg.setZoomJSLib(libPath, '/av');

Error
image

Assumption

By monitoring client’s browser, we realized that zoom resources could not be downloaded, and therefore provoke this undefined error.

We are going to fix this ‘undefined’ generated error and generate a better error message on our application instead, but this does not explain why zoom resources cannot be downloaded.

We regularly face same problem, especially with WASM libraries not being downloaded for what i think being the exact same reason.

Do you have (and reach) usage limits on your AWS CDN ? I don’t see any other explanation from our side as this happen no matter the user and erratically.

Which version?
1.7.10

To Reproduce(If applicable)
Hard to reproduce by ourselves.

Additional context

  • Device: Laptop
  • OS: Windows
  • Version: [e.g. 22]
  • Browser: Chrome (latest version)

Hey @nvivot,

I am wondering where in your code you are initiating the Web SDK and the preload / prepare functions?

If the preload / prepare functions do not have enough time to initiate, this error can be thrown. Checkout the implementation of one of our sample apps, where on initial component load we are immediately calling the preload and prepare functions:

Thanks,
Tommy

@tommy

Here is our code (just for the few initialization lines)

const libPath = `https://${meta.cdnLocation}/${meta.sdkVersion}/lib`;
window.ZoomMtg.setZoomJSLib(libPath, '/av');
window.ZoomMtg.preLoadWasm();
window.ZoomMtg.prepareJssdk();

As you can see

  • first instruction is to configure the library path (which is missing in your example, probably cause it’s done in another section maybe ?)
  • there is no import as we are using CDN version, not NPM local packages.
  • the two methods for pre loading WASM and prepare the SDK are not related to the error at all

Here is the HTML code of the web page that would have all zoom libraries

    <script src="https://<%= process.env.ZOOM_SOURCE_LOCATION %>/<%= process.env.ZOOM_SDK_VERSION %>/lib/vendor/react.min.js"></script>
    <script src="https://<%= process.env.ZOOM_SOURCE_LOCATION %>/<%= process.env.ZOOM_SDK_VERSION %>/lib/vendor/react-dom.min.js"></script>
    <script src="https://<%= process.env.ZOOM_SOURCE_LOCATION %>/<%= process.env.ZOOM_SDK_VERSION %>/lib/vendor/redux.min.js"></script>
    <script src="https://<%= process.env.ZOOM_SOURCE_LOCATION %>/<%= process.env.ZOOM_SDK_VERSION %>/lib/vendor/redux-thunk.min.js"></script>
    <script src="https://<%= process.env.ZOOM_SOURCE_LOCATION %>/<%= process.env.ZOOM_SDK_VERSION %>/lib/vendor/jquery.min.js"></script>
    <script src="https://<%= process.env.ZOOM_SOURCE_LOCATION %>/<%= process.env.ZOOM_SDK_VERSION %>/lib/vendor/lodash.min.js"></script>
    <script src="https://<%= process.env.ZOOM_SOURCE_LOCATION %>/zoom-meeting-<%= process.env.ZOOM_SDK_VERSION %>.min.js"></script>
    <script src="/js/meeting.js"></script>

The error is happening on first line. It’s a javascript error mentioning that the object ZoomMtg is undefined from window component.
The cause of such error could be (this is pure assumption):

  1. the zoom library(ies) could not be downloaded and so could not be loaded on the DOM
  2. the zoom library(ies) could not be loaded on time on the DOM and therefore are unknown

Now, from the screenshot about resources download i provided above, i would say it’s because of option 1. Not to mentioned that when this part of the code pass, then the WASM libraries are pre downloaded right ? Well, some users faces issues to download these WASM libraries (erratically !)

It’s hard to believe that this would come from a limit reached on your CDN as this is a service provided by Amazon. But at the same time, i cannot find another reason explaining these symptoms.
That’s where i need your expertise.

Hey @nvivot,

Thanks for the additional info, our Web SDK engineers will take a loot at this issue. (CS-2358)

I will get back to you with updates. :slight_smile:

-Tommy