# Javascript error in using Web SDK

**URL:** <https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809>\
**Category:** Web\
**Created:** [April 12, 2020, 6:52pm UTC](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809 "2020-04-12T18:52:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![blr](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/blr/32/5079_2.png) [@blr](https://devforum.zoom.us/u/blr)\
**Post date:** [April 12, 2020, 6:52pm UTC](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809/1 "2020-04-12T18:52:55Z")

</div>

**Description**  
I am trying to use Zoom through Web SDK in my website, but I am getting this javascript error

**Error**  
zoom-meeting-1.7.5.min.js:2 Uncaught TypeError: Cannot read property ‘append’ of null  
at zoom-meeting-1.7.5.min.js:2  
at o (zoom-meeting-1.7.5.min.js:2)  
at Object. (zoom-meeting-1.7.5.min.js:2)  
at n (zoom-meeting-1.7.5.min.js:2)  
at Object. (zoom-meeting-1.7.5.min.js:2)  
at n (zoom-meeting-1.7.5.min.js:2)  
at Module. (zoom-meeting-1.7.5.min.js:2)  
at n (zoom-meeting-1.7.5.min.js:2)  
at Module. (zoom-meeting-1.7.5.min.js:2)  
at n (zoom-meeting-1.7.5.min.js:2)

Thanks  
BLR

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [April 13, 2020, 11:06pm UTC](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809/2 "2020-04-13T23:06:10Z")

</div>

Hey @blr,

Can you please provide steps to reproduce this issue? I have not seen this before. 🙂

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![Cristian](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/cristian/32/6823_2.png) [@Cristian](https://devforum.zoom.us/u/Cristian)\
**Post date:** [April 23, 2020, 2:22pm UTC](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809/3 "2020-04-23T14:22:40Z")

</div>

Same here:

and even here:

where no wordpress script are loaded (‘e.g. jQuery’)

After added Zoom SDK via CDN

---

<div class="post-metadata">

**Author:** ![Cristian](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/cristian/32/6823_2.png) [@Cristian](https://devforum.zoom.us/u/Cristian)\
**Post date:** [April 23, 2020, 2:34pm UTC](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809/4 "2020-04-23T14:34:21Z")

</div>

For a moment I solved putting

```
    <script src="https://source.zoom.us/zoom-meeting-1.7.5.min.js"></script>

```

in the footer

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [April 27, 2020, 6:27pm UTC](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809/5 "2020-04-27T18:27:41Z")

</div>

Hey @Cristian,

Yes, please make sure to include the Zoom scripts.

> **[Integrate SDK - Getting Started - Web - Native SDKs - Zoom Software...](https://marketplace.zoom.us/docs/sdk/native-sdks/web/getting-started/integrate)**
>
> Integrate SDK
> 
> The Web SDK can be imported locally into an existing Node.js app through an npm package, or into any HTML5 project through a CDN (content...

> **[@zoomus/websdk](https://www.npmjs.com/package/@zoomus/websdk)**
>
> Zoom Web SDK

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![Cristian](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/cristian/32/6823_2.png) [@Cristian](https://devforum.zoom.us/u/Cristian)\
**Post date:** [April 28, 2020, 11:19am UTC](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809/6 "2020-04-28T11:19:00Z")

</div>

HI @tommy, thanks for the answer.  
It should be better to specify the correct order of the JS, especially when you use CryptoJS and js-base64

Kind Regards

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [May 1, 2020, 5:23pm UTC](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809/7 "2020-05-01T17:23:44Z")

</div>

Hey @Cristian,

Thanks for the suggestion! Did you get it working?

-Tommy

---

<div class="post-metadata">

**Author:** ![Cristian](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/cristian/32/6823_2.png) [@Cristian](https://devforum.zoom.us/u/Cristian)\
**Post date:** [May 7, 2020, 8:25am UTC](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809/8 "2020-05-07T08:25:05Z")

</div>

I used the sample app finally thansk!

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [May 12, 2020, 8:14pm UTC](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809/9 "2020-05-12T20:14:10Z")

</div>

Happy to hear you go it working! 🙂

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![vijay.singh](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vijay.singh/32/9055_2.png) [@vijay.singh](https://devforum.zoom.us/u/vijay.singh)\
**Post date:** [August 6, 2020, 11:35am UTC](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809/10 "2020-08-06T11:35:37Z")

</div>

Hey @tommy I am facing the similar error on integrating Web SDK:  
zoomus-websdk.umd.min.js:2 Uncaught TypeError: Cannot read property ‘0’ of null  
at v (zoomus-websdk.umd.min.js:2)  
at combination (combineReducers.js:120)  
at dispatch (createStore.js:165)  
at index.js:14  
at Object.zmg\_initMeetingConfig (bindActionCreators.js:3)  
at s.value (zoomus-websdk.umd.min.js:2)  
at sentryWrapped (index.js:3204)  
at A (zoomus-websdk.umd.min.js:2)  
at Object.init (zoomus-websdk.umd.min.js:2)  
at ZoomCall.js:74

Below are the scripts file I have added in my index.html (Removed \< before script as the whole line was getting invisible ):  
script src=“[https://source.zoom.us/1.7.10/lib/vendor/react.min.js](https://source.zoom.us/1.7.10/lib/vendor/react.min.js)”\>  
script src=“[https://source.zoom.us/1.7.10/lib/vendor/react-dom.min.js](https://source.zoom.us/1.7.10/lib/vendor/react-dom.min.js)”\>  
script src=“[https://source.zoom.us/1.7.10/lib/vendor/redux.min.js](https://source.zoom.us/1.7.10/lib/vendor/redux.min.js)”\>  
script src=“[https://source.zoom.us/1.7.10/lib/vendor/redux-thunk.min.js](https://source.zoom.us/1.7.10/lib/vendor/redux-thunk.min.js)”\>  
script src=“[https://source.zoom.us/1.7.10/lib/vendor/jquery.min.js](https://source.zoom.us/1.7.10/lib/vendor/jquery.min.js)”\>  
script src=“[https://source.zoom.us/1.7.10/lib/vendor/lodash.min.js](https://source.zoom.us/1.7.10/lib/vendor/lodash.min.js)”\>  
script src=“[https://source.zoom.us/zoom-meeting-1.7.10.min.js](https://source.zoom.us/zoom-meeting-1.7.10.min.js)”\>

Below is how I am generating signature from Django:

```auto
            import hashlib 
            import hmac
            import base64
            import time
            timestamp = int(round(time.time() * 1000)) - 30000
            string_message = settings.ZOOM_API_KEY + str(request.GET.get('meeting_number')) + str(timestamp) +\
                             str(request.GET.get('role'))
            message = base64.b64encode(bytes(string_message, 'utf-8'))
            secret = bytes(settings.ZOOM_API_SECRET, 'utf-8')
            hashing = hmac.new(secret, message, hashlib.sha256)
            hashing = base64.b64encode(hashing.digest())
            hashing = hashing.decode("utf-8")
            temp_string = "%s.%s.%s.%s.%s" % (settings.ZOOM_API_KEY, str(request.GET.get('meeting_number')), str(timestamp),
                                              str(request.GET.get('role')), hashing)
            signature = base64.b64encode(bytes(temp_string, "utf-8"))
            signature = signature.decode("utf-8")
            return JsonResponse({'signature' :signature.rstrip("=")}) 

```

I am using ReactJS for client side code. I am generating signature from my backend in Django and then initializing Zoom in React:

```auto
    ZoomMtg.init({
              disableRecord: false,
              videoDrag: true,
              sharingMode: 'both',
              success: () => {
                ZoomMtg.showRecordFunction({
                  show: true
                });
                ZoomMtg.join(
                  {
                    meetingNumber: {MEETING_NUMBER},
                    userName: '',
                    signature: resp.data.signature,
                    apiKey: process.env.REACT_APP_ZOOM_API_KEY,
                    passWord: '',
                    success: (res) => {
                      console.log('join meeting success:', res);
                    },
                    error: (res) => {
                      console.log('Error point 1:', res);
                    }
                  }
                );
              },
              error: (res) => {
                console.log('Error point 2:', res);
              }
            });

```

Please have a look why this issue would have occurred.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [August 7, 2020, 6:23pm UTC](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809/11 "2020-08-07T18:23:22Z")

</div>

Hey @vijay.singh,

Can you please share a github repo with this issue so I can reproduce it locally and debug?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![vijay.singh](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vijay.singh/32/9055_2.png) [@vijay.singh](https://devforum.zoom.us/u/vijay.singh)\
**Post date:** [August 11, 2020, 6:52am UTC](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809/12 "2020-08-11T06:52:47Z")

</div>

Hey @tommy

Below are the GitHub repo’s each for ReactJS and Django respectively and able to reproduce the error in this.

Hoping for a sooner reply. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [August 11, 2020, 9:04pm UTC](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809/13 "2020-08-11T21:04:10Z")

</div>

Hey @vijay.singh,

You are missing the leaveUrl property in your `ZoomMtg.init({})` function.

Please add it and it will work:

```auto
  ZoomMtg.init({
                disableRecord: false,
                videoDrag: true,
                sharingMode: 'both',
                leaveUrl: 'https://zoom.us',
                success: (res) => {

```

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![vijay.singh](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vijay.singh/32/9055_2.png) [@vijay.singh](https://devforum.zoom.us/u/vijay.singh)\
**Post date:** [August 12, 2020, 4:23am UTC](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809/14 "2020-08-12T04:23:24Z")

</div>

Hey @tommy,

Thank you so much the issue was this only. However I intentionally didn’t want to provide leaveUrl because after the end of the meeting I don’t want to redirect the user to a different webpage since I have to integrate the SDK in my web app so after end of meeting just I want to make video call disappear from DOM and no redirecting to different page should be there. How to achieve this?

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [August 12, 2020, 6:15am UTC](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809/15 "2020-08-12T06:15:43Z")

</div>

Hey @vijay.singh,

Happy to help! 🙂 Glad we figured out the issue!

Currently the Web SDK requires the leaveUrl. Maybe you could navigate to the same page, or a post meeting page of sorts?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![vijay.singh](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vijay.singh/32/9055_2.png) [@vijay.singh](https://devforum.zoom.us/u/vijay.singh)\
**Post date:** [August 12, 2020, 6:23am UTC](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809/16 "2020-08-12T06:23:42Z")

</div>

Hi @tommy,

> [@tommy](#):
>
> or a post meeting page of sorts?

I didn’t undestand this statement, can you please clarify it for me?

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [August 12, 2020, 5:14pm UTC](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809/17 "2020-08-12T17:14:08Z")

</div>

Hey @vijay.singh,

Basically a “Thank you, this meeting has ended” page. You have many options here depending on how you want to handle the post meeting flow.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![grantlatest](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/grantlatest/32/20397_2.png) [@grantlatest](https://devforum.zoom.us/u/grantlatest)\
**Post date:** [December 18, 2020, 11:22pm UTC](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809/18 "2020-12-18T23:22:20Z")

</div>

Hello @tommy  
While init the zoom meeting I got `Uncaught TypeError: Cannot read property ‘0’ of null`  
I set `leaveUrl`  
What what is issue?  
I copied `meeting.js` from the `sample-app-web`.

Thanks.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [December 21, 2020, 7:10pm UTC](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809/19 "2020-12-21T19:10:01Z")

</div>

Hey @grantlatest,

Can you please create a new topic: #client-web-sdk and fill out the post template so we have enough information to help you?

Please include what you are passing in for your `leaveUrl`

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![johnrix](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/johnrix/32/21971_2.png) [@johnrix](https://devforum.zoom.us/u/johnrix)\
**Post date:** [January 28, 2021, 2:15am UTC](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809/20 "2021-01-28T02:15:54Z")

</div>

I came here looking for an answer to the problem raised by @vijay.singh (thanks for the solution @tommy ). While here, I noted that the root cause of the original problem was not actually ever called out clearly in the discussion here. (I encountered that error first myself also.)

Essentially, it was caused by loading (and hence executing) the Zoom SDK javascript files before the DOM is loaded (that is, by including them in the \<head\> section), and hence the append() method on the document.body does not yet exist. Either loading the JavaScript files from inside the \<body\> tags of the HTML (as indicated by the SDK docs), or by using the ‘defer’ attribute on the \<script\> tags if placing them in the \<head\> section, will solve this.

[Next page](https://devforum.zoom.us/t/javascript-error-in-using-web-sdk/12809.md?page=2)
