Uncaught SyntaxError: Unexpected token '<'

Description
I’m trying to integrate the sdk zoom with react, however every time I try to run the project after following all the steps described I have the error ‘Uncaught SyntaxError: Unexpected token ‘<’’ as return

Error
image

Which version?
On the setZoomJsLib i used 1.8.0v and in my packge.json i use the 1.8.1v.

I had test’s from my desktop (win 10) with the google chrome and microsoft edge.

To Reproduce(If applicable)
Steps to reproduce the behavior:
the error occurs as soon as I run the project.

Additional context

This is the component code:
import React from ‘react’;

import { ZoomMtg } from ‘@zoomus/websdk’;

import ‘./zoom.css’;

console.log(“checkSystemRequirements”);

console.log(JSON.stringify(ZoomMtg.checkSystemRequirements()));

ZoomMtg.setZoomJSLib(‘https://source.zoom.us/1.8.0/lib’, ‘/av’);

ZoomMtg.setZoomJSLib(‘node_modules/@zoomus/websdk/dist/lib/’, ‘/av’);

ZoomMtg.preLoadWasm();

ZoomMtg.prepareJssdk();

const Zoom = () => {

const Endpoint = "http://localhost:4000";

var meetingNumber = 75594056340

var user = 'Diego'

var roleUser = 0

const meetConfig = {

    apiKey: process.env.API_KEY,

    meetingNumber: meetingNumber,

    leaveUrl: 'https://www.google.com',

    userName: user,

    userEmail: '',

    passWord: '', // if required

    role: roleUser // 1 for host; 0 for attendee

};

const getSignature = () => {

    fetch(`${Endpoint}`, {

        method: 'POST',

        body: JSON.stringify({ meetingData: meetConfig })

    })

        .then(result => result.text())

        .then(response => {

            ZoomMtg.init({

                leaveUrl: meetConfig.leaveUrl,

                isSupportAV: true,

                success: function () {

                    ZoomMtg.join({

                        signature: response,

                        apiKey: meetConfig.apiKey,

                        meetingNumber: meetConfig.meetingNumber,

                        userName: meetConfig.userName,

                        // password optional; set by Host

                        passWord: meetConfig.passWord,

                        error(res) {

                            console.log(res)

                        }

                    })

                }

            })

        }

)}

return <button onClick={() => getSignature()}>Teste</button>

}

export default Zoom

Hey @diego.luis.gomes2015,

This is most likely happeneing when you are calling JSON.stringify. I am guessing your process.env.API_KEY value is not set or coming through to your code.

Can you try logging process.env.API_KEY before you are calling JSON.stringify to see if you get a value?

Thanks,
Tommy

i fixed the ‘undefined’ process.env.API_KEY but the error still happen

image

Hey @diego.luis.gomes2015,

What is the response you are getting from your signature server?

Are you able to log the response? Also what is .text() doing?

Thanks,
Tommy

I receveid my signature
{
** “signature”: “TnVRMEhkYmtTRk9wRHo2UUpVakd1US43OTM4MzE3MjQxOS4xNjAzMzkxMDExMzE5LjAuUGFUVlFFTDM3djRYQmhsZmt0U0FDSTNYSmdweml6WXZNZU10NnEzM2k4ST0=”**
}

And the .then(result => result.text()), i removed because i don’t use it.

.init em .join works now but the error stills here

Hey @diego.luis.gomes2015,

On the setZoomJsLib i used 1.8.0v and in my packge.json i use the 1.8.1v.

Can you please ensure that you’re providing the version of the SDK that you’re using in your package json here as well: ZoomMtg.setZoomJSLib

Thanks,
Will