**
Uncaught (in promise) ReferenceError: i is not defined
**
**
Error initializing Zoom meeting: ReferenceError: i is not defined
**
I use “@zoom/meetingsdk”: “^3.6.1” in my nextJs application. when I create next build and run the application and try to join zoom meeting I got Uncaught (in promise) ReferenceError: i is not defined error.
'use client';
import axios from 'axios';
import React, { useEffect } from 'react';
import { useStore } from 'src/hooks/useStore';
import { baseUrl } from 'src/const';
function ZoomMeeting({ meetNumber, meetPassword }: MeetingProps) {
const {
rootStore: { authStore },
} = useStore();
let signatureResponse: string;
useEffect(() => {
const getSignature = async () => {
const token = await authStore.getStoredData();
const config = {
headers: {
Authorization: `Bearer ${token?.accessToken}`,
},
};
const signatureRes = await axios.get(
`${baseUrl}/lms/zoom/token?role=${role}&meetingNumber=${meetingNumber}`,
config
);
signatureResponse = signatureRes.data.data.accessToken;
};
getSignature();
const loadData = async () => {
const { ZoomMtg } = await import('@zoom/meetingsdk');
ZoomMtg.preLoadWasm();
ZoomMtg.prepareWebSDK();
function startMeeting() {
(document.getElementById('zmmtg-root') as HTMLElement).style.display =
'block';
(document.getElementById('__next') as HTMLElement).style.display =
'none';
ZoomMtg.init({
leaveUrl: leaveUrl,
patchJsMedia: true,
success: (success: Success) => {
console.log(success);
ZoomMtg.join({
signature: signatureResponse,
sdkKey: sdkKey,
meetingNumber: meetingNumber,
passWord: passWord,
userName: userName,
userEmail: userEmail,
success: (success: Success) => {
console.log(success);
},
error: (error: any) => {
console.log(error);
},
});
},
error: (error: any) => {
console.log(error);
},
});
}
startMeeting();
};
loadData();
}, []);
let sdkKey = process.env.NEXT_PUBLIC_ZOOM_CLIENT_KEY;
let meetingNumber = meetNumber;
let passWord = meetPassword;
let role = 1;
let userName = authStore.userName;
let userEmail = authStore.userEmail;
let leaveUrl = `${process.env.NEXT_PUBLIC_WEB_URL}/admin/sessions`;
return (
<div className="app">
<main></main>
</div>
);
}
export default ZoomMeeting;
interface Success {
method: string;
status: boolean;
errorCode: number;
errorMessage: any;
result: any;
}
interface MeetingProps {
meetNumber: string;
meetPassword: string;
}