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
1 Like

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”: “”**
}

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

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

1 Like

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

Thanks Will
I redid the project but now i used sdk v1.81 and calling then in my compenent with ‘setZoomJsLib 1.8.0v’ this works for me

2 Likes

Happy to hear you got it sorted out @diego.luis.gomes2015! :slight_smile:

Please let us know if you need help with anything else!

-Tommy

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