I use zoom’s api, jwt and the websdk to create a meeting on button click, then join as a host and simultaneously start the meeting enabling others to join. This works fine locally, but somehow when deployed to cloudflare I get the following error:
Your connection has timed out and you cannot join the meeting. Verify your network connectivity and try again.
Error object:
errorCode: 3706
errorMessage: undefined
method: "join"
result: "The meeting number is wrong."
status: false
“The meeting number is wrong” is the wrong message here, since the meeting number provided comes from zoom’s api directly and is working locally. Additionally I checked my scheduled meetings created by the Zoom API, using zoom’s web interface, and I found the IDs/meeting numbers to be matching.
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);
},
});
};
Serverside signature method, which returns I assume the correct signature, since it works locally and logging signature right before the join method returns a proper signature string as well:
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 ever experienced this?