Using zoom's API, jwt, and the websdk, I am able to create a meeting on button click, join as a host, and start the meeting for others to join. This process works flawlessly when running locally, but once deployed to Cloudflare, I encounter the following error:
Your connection has timed out and you cannot join the meeting. Please check your network connectivity and try again.
Error details:
errorCode: 3706
errorMessage: undefined
method: "join"
result: "The meeting number is wrong."
status: false
The error message stating "The meeting number is wrong." seems misleading as the meeting number comes directly from zoom's API and functions correctly locally.
const joinMeeting = async (meetConfig: MeetConfigData) => {
const ZoomMtg = require("@zoomus/websdk").ZoomMtg;
ZoomMtg.setZoomJSLib("https://source.zoom.us/1.9.0/lib", "/av");
ZoomMtg.preLoadWasm();
ZoomMtg.prepareJssdk();
const signature = await generateSignature(meetConfig.role, meetConfig.meetingNumber);
ZoomMtg.init({
leaveUrl: meetConfig.leaveUrl,
isSupportAV: true,
success: () => {
ZoomMtg.join({
signature,
apiKey: "API_KEY",
meetingNumber: meetConfig.meetingNumber,
userName: meetConfig.userName,
passWord: meetConfig.password,
success: () => {
console.log("Successfully hosted or joined meeting.");
},
error: (err: Error) => {
console.log("Error: ", err);
},
});
},
error: (err: Error) => {
console.log("Error: ", err);
},
});
};
The server-side signature method generates the correct signature, which suggests that the issue may lie elsewhere considering it works fine locally:
export const createSignature = ({ role, meetingNumber }) => {
const timestamp = new Date().getTime() - 30000;
const msg = Buffer.from(
process.env.NEXT_PUBLIC_ZOOM_API_KEY + meetingNumber + timestamp + role
).toString("base64");
const hash = crypto
.createHmac("sha256", process.env.NEXT_PUBLIC_ZOOM_API_SECRET)
.update(msg)
.digest("base64");
return Buffer.from(
`${process.env.NEXT_PUBLIC_ZOOM_API_KEY}.${meetingNumber}.${timestamp}.${role}.${hash}`
).toString("base64");
};
Has anyone encountered similar issues before?