# Uncaught ReferenceError: JsMediaSDK\_Instance is not defined

**URL:** <https://devforum.zoom.us/t/uncaught-referenceerror-jsmediasdk-instance-is-not-defined/73978>\
**Category:** Video SDK\
**Created:** [August 10, 2022, 10:24am UTC](https://devforum.zoom.us/t/uncaught-referenceerror-jsmediasdk-instance-is-not-defined/73978 "2022-08-10T10:24:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gourishmesta1993](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gourishmesta1993/32/39300_2.png) [@gourishmesta1993](https://devforum.zoom.us/u/gourishmesta1993)\
**Post date:** [August 10, 2022, 10:24am UTC](https://devforum.zoom.us/t/uncaught-referenceerror-jsmediasdk-instance-is-not-defined/73978/1 "2022-08-10T10:24:12Z")

</div>

**Description**  
I have successfully integrated Video SDK in our react js application. I am be join multiple participant with their roles. but sometimes it keep getting error when joining/creating the session. There are two errors below. Do I miss anything ?

**Error**  
Uncaught ReferenceError: JsMediaSDK\_Instance is not defined  
Uncaught TypeError: Cannot read properties of undefined (reading ‘userRole’)

**Which Web Video SDK version?**  
1.4.0

**To Reproduce(If applicable)**  
[Steps used to join a Session](https://marketplace.zoom.us/docs/sdk/video/web/get-started/)

**Screenshots**

 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/a/e/ae7ed4f5ef4438c4d9d2d9111db99be0c82500ae.png)

I found similar issue over here [https://devforum.zoom.us/t/uncaught-syntaxerror-unexpected-token-in-video-sdk/47751](https://devforum.zoom.us/t/uncaught-syntaxerror-unexpected-token-in-video-sdk/47751)  
but the solutions didn’t work for me

Thank You  
Gourish Mesta

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [August 11, 2022, 3:25am UTC](https://devforum.zoom.us/t/uncaught-referenceerror-jsmediasdk-instance-is-not-defined/73978/2 "2022-08-11T03:25:59Z")

</div>

Hey @gourishmesta1993

Thanks for your feedback.

When you call the `init` method, did you set the second parameter(‘dependentAssets’)? Could you open the devtools and in the ‘network’ tab, then locate the ‘js\_media.min.js’ request? Is the HTTP response of this request correct?

Thanks  
Vic

---

<div class="post-metadata">

**Author:** ![gourishmesta1993](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gourishmesta1993/32/39300_2.png) [@gourishmesta1993](https://devforum.zoom.us/u/gourishmesta1993)\
**Post date:** [August 11, 2022, 10:21am UTC](https://devforum.zoom.us/t/uncaught-referenceerror-jsmediasdk-instance-is-not-defined/73978/3 "2022-08-11T10:21:34Z")

</div>

@vic.yang

Yes when i call the `init` method i set the second parameter (‘dependenetAssets’) as CDN

When the user is successfully able to join the session then below is the network tab screenshot

 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/9/1/9129f24d7c4b2b57fe7c65ed74de690702939254.png)

Unfortunately i am not able to replicate that issue so that i can share u the screenshot of network tab of ‘js\_media.min.js’ request .

Once i get this same error ill post it here.

Thank You

---

<div class="post-metadata">

**Author:** ![shivam.kumar](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shivam.kumar/32/34830_2.png) [@shivam.kumar](https://devforum.zoom.us/u/shivam.kumar)\
**Post date:** [August 16, 2022, 6:52am UTC](https://devforum.zoom.us/t/uncaught-referenceerror-jsmediasdk-instance-is-not-defined/73978/4 "2022-08-16T06:52:27Z")

</div>

hello gourish  
it’ll help you after add init like this  
all error will remove  
zmClient.init(“en-US”, `${window.location.origin}/lib`);

---

<div class="post-metadata">

**Author:** ![gourishmesta1993](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gourishmesta1993/32/39300_2.png) [@gourishmesta1993](https://devforum.zoom.us/u/gourishmesta1993)\
**Post date:** [August 17, 2022, 9:44am UTC](https://devforum.zoom.us/t/uncaught-referenceerror-jsmediasdk-instance-is-not-defined/73978/5 "2022-08-17T09:44:44Z")

</div>

Hi @shivam.kumar

Thank You for the workaround

I’ll add this code and check

---

<div class="post-metadata">

**Author:** ![gourishmesta1993](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gourishmesta1993/32/39300_2.png) [@gourishmesta1993](https://devforum.zoom.us/u/gourishmesta1993)\
**Post date:** [August 23, 2022, 9:27am UTC](https://devforum.zoom.us/t/uncaught-referenceerror-jsmediasdk-instance-is-not-defined/73978/6 "2022-08-23T09:27:59Z")

</div>

Hi @shivam.kumar

after using the code provided by you i am getting even more error

```auto
Uncaught SyntaxError: Unexpected token '<' (at js_media.min.js:1:1)
index.umd.js:1 Uncaught ReferenceError: JsMediaSDK_Instance is not defined
    at Fi.init (index.umd.js:1:1)
    at index.umd.js:1:1
    at t.project (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at e.observe (index.umd.js:1:1)
    at t.dispatch (index.umd.js:1:1)
    at t._execute (index.umd.js:1:1)
    at t.execute (index.umd.js:1:1)
    at t.flush (index.umd.js:1:1)
    at t.schedule (index.umd.js:1:1)
    at e.schedule (index.umd.js:1:1)
    at t.schedule (index.umd.js:1:1)
    at t.scheduleMessage (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t.notifyNext (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t.notifyNext (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t.notifyNext (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t.notifyNext (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t.notifyNext (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t.notifyNext (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at Object.next (index.umd.js:1:1)
    at t.__tryOrUnsub (index.umd.js:1:1)
init @ index.umd.js:1
(anonymous) @ index.umd.js:1
(anonymous) @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
e.observe @ index.umd.js:1
t.dispatch @ index.umd.js:1
t._execute @ index.umd.js:1
t.execute @ index.umd.js:1
t.flush @ index.umd.js:1
t.schedule @ index.umd.js:1
e.schedule @ index.umd.js:1
t.schedule @ index.umd.js:1
t.scheduleMessage @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
next @ index.umd.js:1
t.__tryOrUnsub @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
n @ index.umd.js:1
(anonymous) @ index.umd.js:1
emit @ index.umd.js:1
(anonymous) @ index.umd.js:1
setTimeout (async)
(anonymous) @ index.umd.js:1
t.error @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
e.observe @ index.umd.js:1
t.dispatch @ index.umd.js:1
t._execute @ index.umd.js:1
t.execute @ index.umd.js:1
t.flush @ index.umd.js:1
t.schedule @ index.umd.js:1
e.schedule @ index.umd.js:1
t.schedule @ index.umd.js:1
t.scheduleMessage @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
next @ index.umd.js:1
t.__tryOrUnsub @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
n @ index.umd.js:1
(anonymous) @ index.umd.js:1
emit @ index.umd.js:1
(anonymous) @ index.umd.js:1
Show 101 more frames
index.umd.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'userRole')
    at t.project (index.umd.js:1:1)
    at t._tryNext (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at e.observe (index.umd.js:1:1)
    at t.dispatch (index.umd.js:1:1)
    at t._execute (index.umd.js:1:1)
    at t.execute (index.umd.js:1:1)
    at t.flush (index.umd.js:1:1)
    at t.schedule (index.umd.js:1:1)
    at e.schedule (index.umd.js:1:1)
    at t.schedule (index.umd.js:1:1)
    at t.scheduleMessage (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t.notifyNext (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t.notifyNext (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t.notifyNext (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t.notifyNext (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t.notifyNext (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t.notifyNext (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at t._next (index.umd.js:1:1)
    at t.next (index.umd.js:1:1)
    at index.umd.js:1:1
(anonymous) @ index.umd.js:1
t._tryNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
e.observe @ index.umd.js:1
t.dispatch @ index.umd.js:1
t._execute @ index.umd.js:1
t.execute @ index.umd.js:1
t.flush @ index.umd.js:1
t.schedule @ index.umd.js:1
e.schedule @ index.umd.js:1
t.schedule @ index.umd.js:1
t.scheduleMessage @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
(anonymous) @ index.umd.js:1
(anonymous) @ index.umd.js:1
setTimeout (async)
(anonymous) @ index.umd.js:1
t.error @ index.umd.js:1
t._tryNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
e.observe @ index.umd.js:1
t.dispatch @ index.umd.js:1
t._execute @ index.umd.js:1
t.execute @ index.umd.js:1
t.flush @ index.umd.js:1
t.schedule @ index.umd.js:1
e.schedule @ index.umd.js:1
t.schedule @ index.umd.js:1
t.scheduleMessage @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.notifyNext @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
(anonymous) @ index.umd.js:1
(anonymous) @ index.umd.js:1
setTimeout (async)
next @ index.umd.js:1
t.__tryOrUnsub @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
t._next @ index.umd.js:1
t.next @ index.umd.js:1
n @ index.umd.js:1
(anonymous) @ index.umd.js:1
emit @ index.umd.js:1
(anonymous) @ index.umd.js:1
Show 73 more frames

```

Changing the code back to `client.init("en-US", `CDN`);` works fine

Thank You

---

<div class="post-metadata">

**Author:** ![lingmaaki](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/lingmaaki/32/34307_2.png) [@lingmaaki](https://devforum.zoom.us/u/lingmaaki)\
**Post date:** [November 1, 2022, 9:42pm UTC](https://devforum.zoom.us/t/uncaught-referenceerror-jsmediasdk-instance-is-not-defined/73978/7 "2022-11-01T21:42:33Z")

</div>

If you are using any script file and getting "Uncaught ReferenceError: x is not defined " which means ‘x’ is either a variable or a method which you are trying to use before declaring it using var keyword. This means that there is a non-existent variable referenced somewhere. This variable needs to be declared, or you need to make sure it is available in your current script or scope otherwise , it will endup throwing this ‘x’ is [not defined](http://net-informations.com/jq/iq/defined.htm) error . This usually indicates that your library is not loaded and JavaScript does not recognize the ‘x’.

To solve this error: Load your library at the beginning of all your scripts.

There can be multiple other reasons for this issue:

- Conflict with Other Libraries
- Path to your library included is not correct
- Llibrary file is corrupted
- Working offline (when you use CDN)
