# Unable to integrate @zoomus/websdk (Components/embedded) in a Nextjs app

**URL:** <https://devforum.zoom.us/t/unable-to-integrate-zoomus-websdk-components-embedded-in-a-nextjs-app/90543>\
**Category:** Web\
**Created:** [June 20, 2023, 7:56pm UTC](https://devforum.zoom.us/t/unable-to-integrate-zoomus-websdk-components-embedded-in-a-nextjs-app/90543 "2023-06-20T19:56:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dgbau](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/dgbau/32/49501_2.png) [@dgbau](https://devforum.zoom.us/u/dgbau)\
**Post date:** [June 20, 2023, 7:56pm UTC](https://devforum.zoom.us/t/unable-to-integrate-zoomus-websdk-components-embedded-in-a-nextjs-app/90543/1 "2023-06-20T19:56:18Z")

</div>

**Description**  
I am having quite a lot of trouble integrating the embedded Zoom SDK in a next.js app. The React demo works right away with my API credentials, but I cannot manage to get things working in NextJS. I’ve tried a few methods as found in the forums and SO, but each fails in different ways.

I have searched the forum exhaustively and have found few answers relating to the embedded component view that have answers. I have tried all of these methods to integrate, but none are working:

- (youtube) Learn with NAK - NextJS - Zoom WebSDK Component View - [NextJS - Zoom WebSDK Component View - YouTube](https://www.youtube.com/watch?v=mwta4hZOtpc)
- Script via CDN - [NextJS | Web Meeting SDK | Component View - ReferenceError: window is not defined - #3 by pranshu.midha](https://devforum.zoom.us/t/nextjs-web-meeting-sdk-component-view-referenceerror-window-is-not-defined/64248/3)

**Browser Console Error**

- the solution shown in the YouTube video almost works, but my meeting fails with either

```auto
errorCode: 3706
reason: "The meeting number is wrong."
type: "JOIN_MEETING_FAILED"

```

or

```auto
errorCode: 200
reason: "Fail to join the meeting."
type: "JOIN_MEETING_FAILED"

```

I have triple-checked my meeting credentials and the very same signature and token generator code works with the React app, but not with Next.js version. The “Meeting number is wrong” error is particularly strange.

**Which Web Meeting SDK version?**  
@zoomus/websdk: 2.13.0

**Meeting SDK Code Snippets**  
The code snippets that are causing the error / issue so we can reproduce.

from Learn with NAK youtube video

```auto
import styles from './shared-features-zoom-sdk-player.module.scss';

import { useEffect } from 'react';
import axios from 'axios';
import router from 'next/router';
/* eslint-disable-next-line */
export interface SharedFeaturesZoomSdkPlayerProps {
  meetingNumber: string;
}

export function SharedFeaturesZoomSdkPlayer({ meetingNumber }: SharedFeaturesZoomSdkPlayerProps) {
  useEffect(() => {
    async function getZoomClient() {
      return new Promise(async (resolve, reject) => {
        const zoomEmbed = await (await import('@zoomus/websdk/embedded')).default;
        resolve(zoomEmbed.createClient());
      })
        .then(async (client: any) => {
          const meetingSdkElement = document.getElementById('meetingSdkElement');
          if (meetingSdkElement) {
            client.init({
              language: 'en-US',
              zoomAppRoot: meetingSdkElement
            });
            const payload = router.query;
            const { data } = await axios({ url: '/api/zoom', method: 'POST', data: payload })
              .then((response) => response)
              .catch((error) => {
                console.log('error', error);
              });
            client.join({
              meetingNumber: '3446275386',
              signature: data.signature,
              userName: 'react',
              sdkKey: data.sdkKey,
              tk: '',
            });
          }
        })
        .catch((error) => {
          console.log('error inside zoom useEffect', error);
        });
    }
    getZoomClient();
  }, []);

  return (
    <div className={styles['container']}>
      <div className={styles['meetingSdkElement']} id="meetingSdkElement"></div>
      <div className={styles['content']}>Content</div>
    </div>
  );
}

export default SharedFeaturesZoomSdkPlayer;

```

from the embedded script post, I used the code exactly as presneted, but also fixed the missing `/` from the last div, and trye

**To Reproduce(If applicable)**  
Steps to reproduce the behavior:

For YouTube example

1. use the code above to define a component, and attempt to render it in a nextjs app page with your credentials.
2. observe errors as shown on page load and in console.

For embedded script example:  
use code from this snippet to create a component in a nextjs app and render to a page [NextJS | Web Meeting SDK | Component View - ReferenceError: window is not defined - #3 by pranshu.midha](https://devforum.zoom.us/t/nextjs-web-meeting-sdk-component-view-referenceerror-window-is-not-defined/64248/3)

NOTE: for above link, there is a `/` missing from the last div in the return value.

**Screenshots**

 ![Screenshot 2023-06-20 at 1.38.22 PM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/b/1/b1a726f0a88538c0891a6a80c5f279f9845c82e2.png)

**Troubleshooting Routes**  
In the first instance using await to import module, I have tried double checking all of my meeting parameters that work in the React demo project, but cannot find any indication of why it’s failing with a bad meeting ID.

In the second instance, I am not sure how to troubleshoot this method.

**Device (please complete the following information):**

- Device: MacBook Pro M1
- OS: 13.3 (22E252)
- Browser: Chrome Version 114.0.5735.133 (Official Build) (x86\_64)

**Additional context**  
I have tried various methods of importing the module dynamically, all of which are too numerous to paste here as snippets, but were based on this Stack Overflow article [next.js - nextjs dynamic() import works in dev mode, but not the production, Nextjs13 pages dir #45582 - Stack Overflow](https://stackoverflow.com/questions/75351679/nextjs-dynamic-import-works-in-dev-mode-but-not-the-production-nextjs13-page)

---

<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:** [July 21, 2023, 5:57am UTC](https://devforum.zoom.us/t/unable-to-integrate-zoomus-websdk-components-embedded-in-a-nextjs-app/90543/2 "2023-07-21T05:57:02Z")

</div>

Closed on July 21, 2023, 5:57am UTC

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