Zoom Web SDK CORS error on sending file

Description
On calling chatClient.sendFile(file, userId), I receieve a 403 CORS error. I am making the request from localhost. File upload is enabled in my account settings and chatClient.isFileTransferEnabled() returns true.

Am I missing something obvious? I assume this should be callable from the frontend… right? Video, Audio and chat messages working fine.

Browser Console Error
Access to XMLHttpRequest at ‘https://ngxdv.dv.zoom.us/wc/fileupload?filename=<file_name>&filesize=<file_size>&rwg=<some_value>&cid=<some_value>’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource

Which Web Video SDK version?
1.10.8

Video SDK Code Snippets
async sendChatFile(file: File, userId: number): Promise {
if (file) {
if(this.chatClient.isFileTransferEnabled()) {
await this.chatClient.sendFile(file, userId)
} else {
console.error(‘File transfer is not enabled’)
}
}
}

    client.on('chat-file-upload-progress', (payload) => {
      const { status, progress, fileName } = payload
      if (status === 1) {

//nothing
} else if (status === 3) {
console.log(‘upload failed’)
} else if (status === 4) {
console.log(File ${fileName} upload canceled)
} else if (status === 5) {
console.log(File ${fileName} upload successful.)
}
})

To Reproduce(If applicable)
Steps to reproduce the behavior:
Call sendFile with a file and different userId

Device (please complete the following information):
MacOS Arm64
Google Chrome: 122.0.6261.94

Hey @kevin6

Thanks for your feedback.

We are investigating the cause of the issue. I will inform you of any updates.

Thanks
Vic

Hey @kevin6

We connected to the same server and tested file sending, and it worked. The server can return the correct CORS headers.

Could you check if any network configurations are causing the issue? For example, using a proxy server that filters out these headers?

Thanks
Vic

Hi Vic. I tried again and now it is uploading successfully! Not sure what changed but it’s working now. Thanks!

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