Black screen when joining meeting with Meeting SDK and NextJS

Description
I am trying to implement the Zoom Meeting SDK on my Next JS app. Everything works fine until I join the room. It is working until the waiting room. But when the host lets me in, he sees me in the meeting but I got a black screen and errors on console.

Browser Console Error

instrument.js:122 ReferenceError: React is not defined
at Z (zoomus-websdk.umd.min.js:2:1710663)
at zoomus-websdk.umd.min.js:2:1653009
at l9 (react-dom.production.min.js:153:144)
at c (react-dom.production.min.js:261:494)
at aj (react-dom.production.min.js:246:259)
at react-dom.production.min.js:246:191
at aI (react-dom.production.min.js:246:191)
at react-dom.production.min.js:123:110
at t.unstable_runWithPriority (scheduler.production.min.js:19:460)
at lt (react-dom.production.min.js:122:318)
at ll (react-dom.production.min.js:123:61)
at lr (react-dom.production.min.js:122:496)
at aF (react-dom.production.min.js:240:55)
at Object.notify (zoomus-websdk.umd.min.js:2:6674270)
at Object.notifyNestedSubs (zoomus-websdk.umd.min.js:2:6674681)
at s (zoomus-websdk.umd.min.js:2:6674081)
at g (redux.js:296:1)
at index.js:20:1
at dispatch (redux.js:691:1)
at Module.eX (zoomus-websdk.umd.min.js:2:1146600)
at zoomus-websdk.umd.min.js:2:1205990
at index.js:16:1
at eK (zoomus-websdk.umd.min.js:2:4019154)
at Object.handleOnMessage (zoomus-websdk.umd.min.js:2:4020307)
at a..a..onmessage (zoomus-websdk.umd.min.js:2:4021060)

Uncaught ReferenceError: React is not defined
at Z (zoomus-websdk.umd.min.js:2:1710663)
at zoomus-websdk.umd.min.js:2:1653009
at l9 (react-dom.production.min.js:153:144)
at c (react-dom.production.min.js:261:494)
at aj (react-dom.production.min.js:246:259)
at react-dom.production.min.js:246:191
at aI (react-dom.production.min.js:246:191)
at react-dom.production.min.js:123:110
at t.unstable_runWithPriority (scheduler.production.min.js:19:460)
at lt (react-dom.production.min.js:122:318)
at ll (react-dom.production.min.js:123:61)
at lr (react-dom.production.min.js:122:496)
at aF (react-dom.production.min.js:240:55)
at Object.notify (zoomus-websdk.umd.min.js:2:6674270)
at Object.notifyNestedSubs (zoomus-websdk.umd.min.js:2:6674681)
at s (zoomus-websdk.umd.min.js:2:6674081)
at g (redux.js:296:1)
at index.js:20:1
at dispatch (redux.js:691:1)
at Module.eX (zoomus-websdk.umd.min.js:2:1146600)
at zoomus-websdk.umd.min.js:2:1205990
at index.js:16:1
at eK (zoomus-websdk.umd.min.js:2:4019154)
at Object.handleOnMessage (zoomus-websdk.umd.min.js:2:4020307)
at a..a..onmessage (zoomus-websdk.umd.min.js:2:4021060)

zoomus-websdk.umd.min.js:2 Uncaught TypeError: b.AK.connectSocket is not a function
at e$ (zoomus-websdk.umd.min.js:2:1148875)
at zoomus-websdk.umd.min.js:2:1192692
at index.js:16:1
at eK (zoomus-websdk.umd.min.js:2:4019154)
at Object.handleOnMessage (zoomus-websdk.umd.min.js:2:4020307)
at a..a..onmessage (zoomus-websdk.umd.min.js:2:4021060)

Which Web Meeting SDK version?
2.18.0

Meeting SDK Code Snippets
My Zoom component

/* eslint-disable consistent-return */
import { Box } from '@chakra-ui/react';
import React, {
  useCallback,
  useContext,
  useEffect,
} from 'react';

import { useRouter } from 'next/router';

import { ZoomMtg } from '@zoomus/websdk';
import axios from 'axios';
import { MeContext } from 'modules/_shared/contexts/MeContext';

ZoomMtg.setZoomJSLib('https://source.zoom.us/2.18.0/lib', '/av');

ZoomMtg.preLoadWasm();
ZoomMtg.prepareWebSDK();
// loads language files, also passes any error messages to the ui
ZoomMtg.i18n.load('en-US');
ZoomMtg.i18n.reload('en-US');

const MeetingPage: React.FC = function () {
  const router = useRouter();
  const {
    id,
  } = router.query;

  const { me } = useContext(MeContext);

  const startZoomClient = useCallback(async (): Promise<void> => {
    const { data: { signature } } = await axios.post('/api/zoom', { role: 0, meetingNumber: id });

    ZoomMtg.init({
      leaveUrl: '/patient',
      success: (success: any) => {
        ZoomMtg.join({
          sdkKey: process.env.ZOOM_MEETING_SDK_KEY_OR_CLIENT_ID,
          signature,
          meetingNumber: id as string,
          userName: me?.name || 'Patient',
          success: (s: any) => {
            console.log(s);
          },
          error: (error: any) => {
            console.log(error);
          },
        });
      },
      error: (error: any) => {
        console.log(error);
      },
    });
  }, [id, me?.name]);

  useEffect(() => {
    startZoomClient();
  }, []);

  return (
    <Box />
  );
};

export default MeetingPage;

And my route page

/* eslint-disable consistent-return */
import React from 'react';

import dynamic from 'next/dynamic';

const Zoom = dynamic(() => import('./components/Zoom'), {
  ssr: false,
});

const MeetingPage: React.FC = function () {
  return (
    <Zoom />
  );
};

export default MeetingPage;

Device (please complete the following information):

  • Device: Macbook Air M1
  • OS: [e.g. macOS 13]
  • Browser: Chrome
  • Browser Version 119.0.6045.123 (Official Build) (arm64)

@goldcare

Are you using Client view or component view?

If you are using client view, you will need to use react 16.

I need to use the client view.

I saw this requirement of react 16 and then I gave up to implement it inside my app and tried to use the react sample app cause my project requires react 18.

So I cloned the sample from github and changed the react version of it to 16 ( because it’s react 18.2 in the github project): GitHub - zoom/meetingsdk-react-sample: Use the Zoom Meeting SDK in React

So when I tried to run it I had the same error. React is not defined and a bunch of other errors.

What am I missing? I just cloned the sample app, tried to run (without success), changed the react version in the package json to 16.14 and tried again. Same errors on both attempts.

ERROR
[object Object]
    at handleError (http://localhost:3001/static/js/bundle.js:330939:58)
    at http://localhost:3001/static/js/bundle.js:330962:7
ERROR
React is not defined
ReferenceError: React is not defined
    at B (http://localhost:3001/static/js/bundle.js:70480:28)
    at http://localhost:3001/static/js/bundle.js:67575:65
    at renderWithHooks (http://localhost:3001/static/js/bundle.js:315718:22)
    at mountIndeterminateComponent (http://localhost:3001/static/js/bundle.js:318048:17)
    at beginWork (http://localhost:3001/static/js/bundle.js:318985:20)
    at HTMLUnknownElement.callCallback (http://localhost:3001/static/js/bundle.js:303015:18)
    at Object.invokeGuardedCallbackDev (http://localhost:3001/static/js/bundle.js:303059:20)
    at invokeGuardedCallback (http://localhost:3001/static/js/bundle.js:303107:35)
    at beginWork$1 (http://localhost:3001/static/js/bundle.js:322888:11)
    at performUnitOfWork (http://localhost:3001/static/js/bundle.js:322009:16)
ERROR
React is not defined
ReferenceError: React is not defined
    at B (http://localhost:3001/static/js/bundle.js:70480:28)
    at http://localhost:3001/static/js/bundle.js:67575:65
    at renderWithHooks (http://localhost:3001/static/js/bundle.js:315718:22)
    at mountIndeterminateComponent (http://localhost:3001/static/js/bundle.js:318048:17)
    at beginWork (http://localhost:3001/static/js/bundle.js:318985:20)
    at HTMLUnknownElement.callCallback (http://localhost:3001/static/js/bundle.js:303015:18)
    at Object.invokeGuardedCallbackDev (http://localhost:3001/static/js/bundle.js:303059:20)
    at invokeGuardedCallback (http://localhost:3001/static/js/bundle.js:303107:35)
    at beginWork$1 (http://localhost:3001/static/js/bundle.js:322888:11)
    at performUnitOfWork (http://localhost:3001/static/js/bundle.js:322009:16)
ERROR
m.AK.connectSocket is not a function
TypeError: m.AK.connectSocket is not a function
    at tn (http://localhost:3001/static/js/bundle.js:43449:157)
    at rn (http://localhost:3001/static/js/bundle.js:46177:69)
    at http://localhost:3001/static/js/bundle.js:46871:26
    at http://localhost:3001/static/js/bundle.js:327601:18
    at Yt (http://localhost:3001/static/js/bundle.js:183143:69)
    at Object.handleOnMessage (http://localhost:3001/static/js/bundle.js:183177:26)
    at i.<computed>.i.<computed>.onmessage (http://localhost:3001/static/js/bundle.js:183212:26)
ERROR
m.AK.connectSocket is not a function
TypeError: m.AK.connectSocket is not a function
    at tn (http://localhost:3001/static/js/bundle.js:43449:157)
    at rn (http://localhost:3001/static/js/bundle.js:46177:69)
    at http://localhost:3001/static/js/bundle.js:46871:26
    at http://localhost:3001/static/js/bundle.js:327601:18
    at Yt (http://localhost:3001/static/js/bundle.js:183143:69)
    at Object.handleOnMessage (http://localhost:3001/static/js/bundle.js:183177:26)
    at i.<computed>.i.<computed>.onmessage (http://localhost:3001/static/js/bundle.js:183212:26)
ERROR
m.AK.connectSocket is not a function
TypeError: m.AK.connectSocket is not a function
    at tn (http://localhost:3001/static/js/bundle.js:43449:157)
    at rn (http://localhost:3001/static/js/bundle.js:46177:69)
    at http://localhost:3001/static/js/bundle.js:46871:26
    at http://localhost:3001/static/js/bundle.js:327601:18
    at Yt (http://localhost:3001/static/js/bundle.js:183143:69)
    at Object.handleOnMessage (http://localhost:3001/static/js/bundle.js:183177:26)
    at i.<computed>.i.<computed>.onmessage (http://localhost:3001/static/js/bundle.js:183212:26)
ERROR
m.AK.connectSocket is not a function
TypeError: m.AK.connectSocket is not a function
    at tn (http://localhost:3001/static/js/bundle.js:43449:157)
    at rn (http://localhost:3001/static/js/bundle.js:46177:69)
    at http://localhost:3001/static/js/bundle.js:46871:26
    at http://localhost:3001/static/js/bundle.js:327601:18
    at Yt (http://localhost:3001/static/js/bundle.js:183143:69)
    at Object.handleOnMessage (http://localhost:3001/static/js/bundle.js:183177:26)
    at i.<computed>.i.<computed>.onmessage (http://localhost:3001/static/js/bundle.js:183212:26)
ERROR
m.AK.connectSocket is not a function
TypeError: m.AK.connectSocket is not a function
    at tn (http://localhost:3001/static/js/bundle.js:43449:157)
    at rn (http://localhost:3001/static/js/bundle.js:46177:69)
    at http://localhost:3001/static/js/bundle.js:46871:26
    at http://localhost:3001/static/js/bundle.js:327601:18
    at Yt (http://localhost:3001/static/js/bundle.js:183143:69)
    at Object.handleOnMessage (http://localhost:3001/static/js/bundle.js:183177:26)
    at i.<computed>.i.<computed>.onmessage (http://localhost:3001/static/js/bundle.js:183212:26)
ERROR
m.AK.connectSocket is not a function
TypeError: m.AK.connectSocket is not a function
    at tn (http://localhost:3001/static/js/bundle.js:43449:157)
    at rn (http://localhost:3001/static/js/bundle.js:46177:69)
    at http://localhost:3001/static/js/bundle.js:46871:26
    at http://localhost:3001/static/js/bundle.js:327601:18
    at Yt (http://localhost:3001/static/js/bundle.js:183143:69)
    at Object.handleOnMessage (http://localhost:3001/static/js/bundle.js:183177:26)
    at i.<computed>.i.<computed>.onmessage (http://localhost:3001/static/js/bundle.js:183212:26)
ERROR
m.AK.connectSocket is not a function
TypeError: m.AK.connectSocket is not a function
    at tn (http://localhost:3001/static/js/bundle.js:43449:157)
    at rn (http://localhost:3001/static/js/bundle.js:46177:69)
    at http://localhost:3001/static/js/bundle.js:46871:26
    at http://localhost:3001/static/js/bundle.js:327601:18
    at Yt (http://localhost:3001/static/js/bundle.js:183143:69)
    at Object.handleOnMessage (http://localhost:3001/static/js/bundle.js:183177:26)
    at i.<computed>.i.<computed>.onmessage (http://localhost:3001/static/js/bundle.js:183212:26)
ERROR
m.AK.connectSocket is not a function
TypeError: m.AK.connectSocket is not a function
    at tn (http://localhost:3001/static/js/bundle.js:43449:157)
    at rn (http://localhost:3001/static/js/bundle.js:46177:69)
    at http://localhost:3001/static/js/bundle.js:46871:26
    at http://localhost:3001/static/js/bundle.js:327601:18
    at Yt (http://localhost:3001/static/js/bundle.js:183143:69)
    at Object.handleOnMessage (http://localhost:3001/static/js/bundle.js:183177:26)
    at i.<computed>.i.<computed>.onmessage (http://localhost:3001/static/js/bundle.js:183212:26)
ERROR
m.AK.connectSocket is not a function
TypeError: m.AK.connectSocket is not a function
    at tn (http://localhost:3001/static/js/bundle.js:43449:157)
    at rn (http://localhost:3001/static/js/bundle.js:46177:69)
    at http://localhost:3001/static/js/bundle.js:46871:26
    at http://localhost:3001/static/js/bundle.js:327601:18
    at Yt (http://localhost:3001/static/js/bundle.js:183143:69)
    at Object.handleOnMessage (http://localhost:3001/static/js/bundle.js:183177:26)
    at i.<computed>.i.<computed>.onmessage (http://localhost:3001/static/js/bundle.js:183212:26)
ERROR
m.AK.connectSocket is not a function
TypeError: m.AK.connectSocket is not a function
    at tn (http://localhost:3001/static/js/bundle.js:43449:157)
    at rn (http://localhost:3001/static/js/bundle.js:46177:69)
    at http://localhost:3001/static/js/bundle.js:46871:26
    at http://localhost:3001/static/js/bundle.js:327601:18
    at Yt (http://localhost:3001/static/js/bundle.js:183143:69)
    at Object.handleOnMessage (http://localhost:3001/static/js/bundle.js:183177:26)
    at i.<computed>.i.<computed>.onmessage (http://localhost:3001/static/js/bundle.js:183212:26)
ERROR
m.AK.connectSocket is not a function
TypeError: m.AK.connectSocket is not a function
    at tn (http://localhost:3001/static/js/bundle.js:43449:157)
    at rn (http://localhost:3001/static/js/bundle.js:46177:69)
    at http://localhost:3001/static/js/bundle.js:46871:26
    at http://localhost:3001/static/js/bundle.js:327601:18
    at Yt (http://localhost:3001/static/js/bundle.js:183143:69)
    at Object.handleOnMessage (http://localhost:3001/static/js/bundle.js:183177:26)
    at i.<computed>.i.<computed>.onmessage (http://localhost:3001/static/js/bundle.js:183212:26)
ERROR
m.AK.connectSocket is not a function
TypeError: m.AK.connectSocket is not a function
    at tn (http://localhost:3001/static/js/bundle.js:43449:157)
    at rn (http://localhost:3001/static/js/bundle.js:46177:69)
    at http://localhost:3001/static/js/bundle.js:46871:26
    at http://localhost:3001/static/js/bundle.js:327601:18
    at Yt (http://localhost:3001/static/js/bundle.js:183143:69)
    at Object.handleOnMessage (http://localhost:3001/static/js/bundle.js:183177:26)
    at i.<computed>.i.<computed>.onmessage (http://localhost:3001/static/js/bundle.js:183212:26)

Here’s my package json:

{
  "name": "meetingsdk-sample-react",
  "version": "2.18.0",
  "author": "Zoom Video Communications, Inc.",
  "contributors": [
    {
      "name": "Tommy Gaessler"
    }
  ],
  "homepage": "",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^6.1.4",
    "@testing-library/react": "^14.0.0",
    "@testing-library/user-event": "^14.5.1",
    "@zoomus/websdk": "^2.18.0",
    "react": "16.14.0",
    "react-dev-utils": "^12.0.1",
    "react-dom": "16.14.0",
    "react-scripts": "^5.0.1",
    "web-vitals": "^3.5.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

I got it working. The issue is with the latest SDK version. I downgraded to 2.17.0 and everything worked fine.

I have the same problem but this solution does not work for me