Cannot read property 'toString' of undefined

Description
Hi, I am using Zoom SDK version 1.9.7. When I join the meeting, I have this error:

Here is my code on the front end:
import React, { useEffect } from ‘react’;
import { ZoomMtg } from ‘@zoomus/websdk’;
import axios from ‘axios’;
import dotenv from ‘dotenv’;
dotenv.config();

let apiKey = process.env.REACT_APP_API_KEY;
let apiSecret = process.env.REACT_APP_API_SECRET;

let meetingNumber = 4807878242
let role = 0

let leaveUrl = ‘http://localhost:3000
let userName = ‘WebSDK’
let userEmail = ‘test@gmail.com’
let passWord = ‘5kyRTG’

function Zoom() {
const showZoomDiv = () => {
document.querySelector(’#zmmtg-root’).style.display = ‘block’;
}

const initiateMeeting = async () => {
    const { signature } = await axios.post('http://localhost:3001/signature', { meetingNumber, role });

    ZoomMtg.init({
        leaveUrl: leaveUrl,
        isSupportAV: true,
        success: (success) => {
            console.log(success)

            ZoomMtg.join({
                signature: signature,
                meetingNumber: meetingNumber,
                userName: userName,
                apiKey: apiKey,
                userEmail: userEmail,
                passWord: passWord,
                success: (success) => {
                    console.log(success)
                },
                error: (error) => {
                    console.log(error)
                }
            })

        },
        error: (error) => {
            console.log(error)
        }
    })
}

useEffect(() => {
    showZoomDiv();
    ZoomMtg.setZoomJSLib('https://source.zoom.us/1.9.7/lib', '/av');
    ZoomMtg.preLoadWasm();
    ZoomMtg.prepareJssdk();
    initiateMeeting();
}, [])

return (
    <div>

    </div>
)

}

export default Zoom

and here is the code for the backend to get the signature:
app.post(’/signature’, (req, res) => {
const apiKey = process.env.API_KEY;
const apiSecret = process.env.API_SECRET;
const meetingNumber = req.body.meetingNumber;
const role = req.body.role;

// Prevent time sync issue between client signature generation and zoom 
const timestamp = new Date().getTime() - 30000
const msg = Buffer.from(apiKey + meetingNumber + timestamp + role).toString('base64')
const hash = crypto.createHmac('sha256', apiSecret).update(msg).digest('base64')
const signature = Buffer.from(`${apiKey}.${meetingNumber}.${timestamp}.${role}.${hash}`).toString('base64')

res.json({ signature })

})

Can you help be find out what’s wrong
Error
The full error message or issue you are running into.

Which Web Client SDK version?
Knowing the version can help us to identify your issue faster. [e.g. 1.9.0]

To Reproduce(If applicable)
Steps to reproduce the behavior:

  1. Go to ‘…’
  2. Click on ‘…’
  3. Scroll down to ‘…’
  4. See error

Screenshots
If applicable, add screenshots to help explain your problem.

Device (please complete the following information):

  • Device: [e.g. iPhone 12]
  • OS: [e.g. iOS 14]
  • Browser: [e.g. Chrome]
  • Browser Version [e.g. 88.0.4324.150 (Official Build) (x86_64)]

Additional context
Add any other context about the problem here.

Greetings, @binkei2311 ,

Welcome to the Developer Forum – I am thrilled to help out here. As a start, please make sure that you are loading the required files at the top of that file. If that doesn’t help, are you able to share a public git repo with the code demonstrating this issue so I can reproduce it locally and debug ?

Best,
Donte

@binkei2311 I’d suggest logging out all of your arguments you’re passing to the join method as a sanity check. My first guess would be one of those are not resolving correctly and the SDK isn’t null checking it prior to the string conversion.

Also, I noticed with 1.9.7 the sample app is calling ZoomMtg.prepareWebSDK() instead of prepareJssdk(), and the latter has disappeared from the reference documents, so that could also be something:

https://marketplace.zoom.us/docs/sdk/native-sdks/web/reference

FYI @donte.S, the link to getting started still shows the required call is prepareJssdk(). I only realised this changed by diffing the latest versions of the Angular sample app on the Github repo so it might be useful for this to be added in the changelog?

Hi, @mijodu,

You’re right ! Great catch, I will work with our documents team to get that updated. Thank you so much for sharing that insight – we are truly lucky to have you as a community member !

Thank you for choosing Zoom !

~ Donte :innocent:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.