简体   繁体   中英

Zoom-sdk works locally, but not when deployed

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 obviously the wrong message here, since the meeting number provided comes from zoom's API directly and is working 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);
        },
    });
};

Serverside signature method which returns the correct signature since, again, it works 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 ever experienced this?

if you are getting this (Receiving “Your connection has timed out and you cannot join the meeting” when joining a meeting that has not started) error need to do something

Search in your project

and replace with

enter image description here After doing that error will go away enter image description here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM