# Window undefined with 1.8.5

**URL:** <https://devforum.zoom.us/t/window-undefined-with-1-8-5/39247>\
**Category:** Web\
**Created:** [December 27, 2020, 3:15pm UTC](https://devforum.zoom.us/t/window-undefined-with-1-8-5/39247 "2020-12-27T15:15:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Safwen](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/safwen/32/20416_2.png) [@Safwen](https://devforum.zoom.us/u/Safwen)\
**Post date:** [December 27, 2020, 3:15pm UTC](https://devforum.zoom.us/t/window-undefined-with-1-8-5/39247/1 "2020-12-27T15:15:59Z")

</div>

**Description**  
Getting window is not defined error when trying to integrate web SDK  
**Error**  
ReferenceError: window is not defined  
at Object. (…/node\_modules/@zoomus/websdk/dist/zoomus-websdk.umd.min.js:2:504)

**Which version?**  
1.8.5

**Additional context**

```
      export const Zoom = () => {
      useEffect(() => {
    ZoomMtg.setZoomJSLib("https://source.zoom.us/1.8.5/lib", "/av");
    ZoomMtg.preLoadWasm();
    ZoomMtg.prepareJssdk();
    ZoomMtg.generateSignature({
      meetingNumber: zoomConfig.meetingNumber,
      apiKey: zoomConfig.apiKey,
      apiSecret: zoomConfig.apiSecret,

  role: zoomConfig.role,
  success: function (res) {
    setTimeout(() => {
      joinMeeting(res.result, zoomConfig);
    }, 1000);

    console.log("res", res);
  },
});
  }, []);
  return <>Zoom will be here</>;
};

```

I added :

```
 <link type="text/css" rel="stylesheet"href="https://source.zoom.us/1.8.5/css/bootstrap.css"/>

<link type="text/css" rel="stylesheet"href="https://source.zoom.us/1.8.5/css/react-select.css"/>
        
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>    

```

still not working any ideas where is this coming from ?

---

<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 28, 2020, 6:21pm UTC](https://devforum.zoom.us/t/window-undefined-with-1-8-5/39247/2 "2020-12-28T18:21:08Z")

</div>

Hey @Safwen,

Can you please provide steps to reproduce the issue? I am not seeing this issue when testing on my end.

If you are using React, you can see the Web SDK React Sample App here:

> **[zoom/websdk-sample-react](https://github.com/zoom/websdk-sample-react)**
>
> Use the Zoom Web SDK in a React App. Contribute to zoom/websdk-sample-react development by creating an account on GitHub.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![Safwen](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/safwen/32/20416_2.png) [@Safwen](https://devforum.zoom.us/u/Safwen)\
**Post date:** [December 28, 2020, 6:40pm UTC](https://devforum.zoom.us/t/window-undefined-with-1-8-5/39247/3 "2020-12-28T18:40:53Z")

</div>

Hi @tommy

Thank you for reaching out I really appreciate the effort you’re putting here:  
So basically it’s NextJS app and currently I got it to work by doing this:

inside the useEffect of the zoom component:

```
    useEffect(() => {
      import("@zoomus/websdk").then((module) => {
      const { ZoomMtg } = module;
      ZoomMtg.setZoomJSLib("https://source.zoom.us/1.8.5/lib", "/av");
      ZoomMtg.preLoadWasm();
      ZoomMtg.prepareJssdk();
 ...

```

Still wondering why a simple import had to be this way  
it could be something with the SSR nature of Next but still it doesn’t make lot of sense to me

Also another question :  
I notice when I navigate to another route without ( hitting the zoom meeting leave button ) when I click on my join button it throws an error : ’ you need to initiate a meeting ’ which the button does already but it seems it only works upon refreshing  
So my question is do I need to clean the meeting manually when navigating to another route?

---

<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 29, 2020, 5:23pm UTC](https://devforum.zoom.us/t/window-undefined-with-1-8-5/39247/4 "2020-12-29T17:23:43Z")

</div>

Hey @Safwen,

Happy to hear you got it sorted out! 🙂

I am not too familiar with Next, so I don’t know the specifics of how imports work.

> [@Safwen](#):
>
> on my join button it throws an error : ’ you need to initiate a meeting ’ which the button does already but it seems it only works upon refreshing  
> So my question is do I need to clean the meeting manually when navigating to another route?

Hm, after leaving a meeting you should be able to join another one. Make sure the ZoomMtg.init function is being called again. 🙂

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [January 29, 2021, 3:23am UTC](https://devforum.zoom.us/t/window-undefined-with-1-8-5/39247/5 "2021-01-29T03:23:51Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
