Error: TypeError: Failed to construct 'URL': Invalid URL

Title: Error: TypeError: Failed to construct ‘URL’: Invalid URL

Description: I’m encountering an error while integrating the Zoom Web SDK into my application. Whenever I attempt to [describe the action causing the error, e.g., initialize the SDK, join a meeting, etc.], I receive the following error message:

TypeError: Failed to construct ‘URL’: Invalid URL
at 41633 (zoomus-websdk-main-client.umd.min.js:2:2753233)
at a (zoomus-websdk.umd.min.js:2:1)
at 1975 (zoomus-websdk-main-client.umd.min.js:2:2790357)
at a (zoomus-websdk.umd.min.js:2:1)
at 3459 (zoomus-websdk-main-client.umd.min.js:2:2745866)
at a (zoomus-websdk.umd.min.js:2:1)
at 47023 (zoomus-websdk-main-client.umd.min.js:2:1285779)
at a (zoomus-websdk.umd.min.js:2:1)
at 22575 (zoomus-websdk-main-client.umd.min.js:2:1280605)
at a (zoomus-websdk.umd.min.js:2:1)

Additional Context:

  • Operating System: Windows 10
  • Browser: Chrome
  • Zoom SDK Version: 3.5.2
  • Any additional information that may be relevant to troubleshooting the issue.

@SaiVenkatesh79 I’ll PM you for more details

let authEndpoint = “http://localhost:4000/”;
let sdkKey = “D3_zv6ClRCikIdWIozCDtQ”;
let sdkSecret = “”;
let meetingNumber = “2226637344”;
let passWord = “”;
let role = 0;
let userName = “React_Zoom”;
let userEmail = “”;
let registrantToken = “”;
let zakToken = “”;
let leaveUrl = “http://localhost:3000”;

function getSignature(e) {
e.preventDefault();

fetch(authEndpoint, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    meetingNumber: meetingNumber,
    role: role,
  }),
})
  .then((res) => res.json())
  .then((response) => {
    startMeeting(response.signature);
    console.log(response);
  })
  .catch((error) => {
    console.error(error);
  });

}

// function getSignature(){
// ZoomMtg.generateSDKSignature({
// meetingNumber: meetingNumber,
// role: role,
// sdkKey: sdkKey,
// sdkSecret: sdkSecret,
// success: (signature) => {
// console.log(signature);
// startMeeting(signature);
// },
// error: (res) => {
// console.log(res);
// },
// })
// }

function startMeeting(signature) {
ZoomMtg.init({
leaveUrl: leaveUrl,
patchJsMedia: true,
success: (success) => {
console.log(success);

    ZoomMtg.join({
      signature: signature,
      sdkKey: sdkKey,
      meetingNumber: meetingNumber,
      passWord: passWord,
      userName: userName,
      userEmail: userEmail,
      tk: registrantToken,
      zak: zakToken,
      success: (success) => {
        console.log(success);
      },
      error: (error) => {
        console.log(error);
      },
    });
  },
  error: (error) => {
    console.log(error);
  },
});

}

SDK key: “D3_zv6ClRCikIdWIozCDtQ”

SDK Secret : “”

If zoom/meetingsdk-auth-endpoint-sample I will get error: “Signature Invalid”,

Signaure : “eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBLZXkiOiJEM196djZDbFJDaWtJZFdJb3pDRHRRIiwic2RrS2V5IjoiRDNfenY2Q2xSQ2lrSWRXSW96Q0R0USIsIm1uIjoiMjIyNjYzNzM0NCIsInJvbGUiOjAsImlhdCI6MTcxMjI5MTQ4MCwiZXhwIjoxNzEyMjk4NjgwLCJ0b2tlbkV4cCI6MTcxMjI5ODY4MH0.AmC9Drjw0QKUFJqoFP6p6EGJh_aYK8ykjDdBgDthHtI”

If I use this endpoint code I will get “Failed to join meeting”

const express = require(“express”);
const bodyParser = require(“body-parser”);
const cors = require(“cors”);
const KJUR = require(“jsrsasign”);

require(“dotenv”).config();

process.env.NODE_NO_WARNINGS = 1;

const app = express();

const port = 5000;

app.use(cors());
app.use(bodyParser.urlencoded({ extended: true }));

app.use(bodyParser.json());

app.get(“/”, (req, res)=>{
res.send(“Welcome to the server!”);
});

app.post(“/signature”, async (req, res) => {
const iat = Math.round(new Date().getTime() / 1000) - 30;
const exp = iat + 60 * 60 * 2;

const Header = {
alg: “HS256”,
typ: “JWT”,
};

const Payload = {
mn: req.body.meetingNumber,
role: req.body.role,
sdkKey: process.env.ZOOM_MEETING_SDK_KEY,
iat: iat,
exp: exp,
};

const signature = KJUR.jws.JWS.sign(
“HS256”,
JSON.stringify(Header),
JSON.stringify(Payload),
process.env.ZOOM_MEETING_SDK_SECRET
);

return res.json({
signature: signature
});
});

app.listen(port, () => {
console.log("Server is running on port: " + port);
});


Signature: " eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtbiI6IjIyMjY2MzczNDQiLCJyb2xlIjowLCJzZGtLZXkiOiInRDNfenY2Q2xSQ2lrSWRXSW96Q0R0USc7IiwiaWF0IjoxNzEyMjkxNTc1LCJleHAiOjE3MTIyOTg3NzV9.ssyHddkmFl7i3wosOCdxwaRYHfFFFdKvorEuGuAr1fo"

Hi @chunsiong.zoom I have done some research on this and problem area is at cookies…

Chrome blocks third party cookies which don’t have its SameSite value it will be treated as by default it would be SameSite:Lux

For that I am using Firefox and changes its config for Same-site cookies be true and Zoom SDK respose should be SameSite:None; secure
image

@SaiVenkatesh79

Could you provide another token which has a longer expiry?

{
“meetingNumber”: “2226637344”,
“role”: 0
}

Sdk_key : D3_zv6ClRCikIdWIozCDtQ
Sdk_secret:

(github) Zoom_sample_auth_end_point : “http://localhost:4000

{
“signature”: “eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBLZXkiOiJEM196djZDbFJDaWtJZFdJb3pDRHRRIiwic2RrS2V5IjoiRDNfenY2Q2xSQ2lrSWRXSW96Q0R0USIsIm1uIjoiMjIyNjYzNzM0NCIsInJvbGUiOjAsImlhdCI6MTcxMjMwMzIxMCwiZXhwIjoxNzEyMzEwNDEwLCJ0b2tlbkV4cCI6MTcxMjMxMDQxMH0.TWmQCLg08ZmCBAVYTxGH50_b5J6_5UuAiHGByyyh-CQ”
}

@SaiVenkatesh79

can you turn this on?



Done!




Back to the beginging…

I’ll PM you for the password of the meeting