Joining meeting timeout issue happening randomly

Description
I’m working on integrating Zoom meetings into the website I work at using a rails BE and React FE. Init works consistently, but join fails quite often, roughly 1 out of every 3 times it throws the error “Joining meeting timeout”.

Error
Joining meeting timeout
Your connection has timed out and you cannot join the meeting. Verify your network connectivity and try again.
{method: “join”, status: false, result: null, errorMessage: undefined, errorCode: 1}

Which version?
1.7.9

Code snippets

This is the code I’m using to call the API and create the meeting in the BE (I’ve had no issues there):

def create_meeting(creator_id, topic)
  params = {
    topic: topic
  }

  response = RestClient.post(
    "#{ZOOM_API_URL}/users/#{creator_id}/meetings",
    params.to_json,
    content_type: :json,
    accept: :json,
    Authorization: 'Bearer ' + jwt_token,
    timeout: 100
  )
  return JSON.parse(response)
end

def jwt_token
  payload = {
    exp: Time.now.to_i + 100,
    iss: OneEye::ZOOM_API_KEY
  }
  JWT.encode payload, ZOOM_API_SECRET, 'HS256', { typ: 'JWT' }
end

This is the code used to generate the signature:

def set_signature(user)
  role = user.id == self.creator_id ? '1' : '0'
  time = (Time.now.to_i * 1000 - 30000).to_s
  data = Base64.urlsafe_encode64(OneEye::ZOOM_API_KEY + self.zoom_id.to_s + time + role)
  hash = Base64.urlsafe_encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), OneEye::ZOOM_API_SECRET, data))
  tempStr = OneEye::ZOOM_API_KEY + '.' + self.zoom_id.to_s + '.' + time + '.' + role + '.' + hash
  self.signature = Base64.urlsafe_encode64(tempStr).gsub('+', '-').gsub('/', '_').gsub(/#{Regexp.escape('=')}+$/, '')
end

And this is the Javascript code I’m using to init/join the meeting:

import { ZoomMtg } from '@zoomus/websdk';
ZoomMtg.setZoomJSLib('https://source.zoom.us/1.7.8/lib', '/av'); // <= tried 1.7.9 but it results in a JS error
ZoomMtg.preLoadWasm();
ZoomMtg.prepareJssdk();

// In the callback func after the server returns the signature/meetingNumber
const { signature, zoom_id } = response.data; // <= this comes from the BE
ZoomMtg.init({
  leaveUrl: url,
  success: function() {
    ZoomMtg.join({
      signature: signature,
      apiKey: ZOOM_API_KEY,
      meetingNumber: zoom_id,
      userName: UserHelper.formatName(currentUser),
      passWord: '',
      error: function(res){console.log(res)},
      success: function(res){console.log(res)},
    });
  }
});

A few things I’ve tried:

  • Tested with several different versions of the SDK, starting at 1.7.4; got the same results.
  • Added delays to the success functions in case the issue was caused by a race condition, but I got the same results.
  • Tried different values for the time param when generating the signature; it didn’t make a difference.

Thanks!

Hey @edmodev,

Can you make sure that the ZoomMtg.preLoadWasm(); and ZoomMtg.prepareJssdk(); functions are completing before joining the meeting? Try giving it a buffer of a few seconds and let me know if that works.

Thanks,
Tommy

Unfortunately I actually tried that already, I added as much as 20 sec delay before running init/join, but it didn’t affect the results, it still failed/worked at around the same rate.

Thanks

Hey @edmodev,

I think the issue is you are importing the Web SDK locally, and also using the CDN reference.

Can you try removing this line ZoomMtg.setZoomJSLib('https://source.zoom.us/1.7.8/lib', '/av');

And make sure your path to the Local Web SDK in node modules is correct:

Thanks,
Tommy

I copied the lib from node_modules to an accessible location, changed the line into this:

ZoomMtg.setZoomJSLib('http://localhost:3001/zoom_lib', '/av');

And loaded the additional files that are needed:

<script type="text/javascript" src="http://localhost:3001/zoom_lib/webim.min.js"></script>
<script type="text/javascript" src="http://localhost:3001/zoom_lib/av/js_media.min.js"></script>

Retried setting timeouts before both init and join in case there was a race condition while loading those files, but I’m still seeing random failures. Here’s a gif of what I’m experiencing:

Hey @edmodev,

Are there any errors in the browser console?

Thanks,
Tommy

There’s a couple of unrelated errors that I always see when running the code for the website I work at locally:

But the same exact errors are also there when it does work:

Just fixed the issue.

Looked for examples of signature generation using ruby and in the one I could find where the user was able to get it to work I noticed that strict_encode64 was used instead of urlsafe_encode64, so I tried that. Ever since I made that change, join has been working consistently. The final ruby code looks like this:

def set_signature(user)
  role = user.id == self.creator_id ? '1' : '0'
  time = (Time.now.to_i * 1000 - 30000).to_s
  data = Base64.strict_encode64(ZOOM_API_KEY + self.zoom_id.to_s + time + role)
  hash = Base64.strict_encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), ZOOM_API_SECRET, data))
  tempStr = ZOOM_API_KEY + '.' + self.zoom_id.to_s + '.' + time + '.' + role + '.' + hash
  self.signature = Base64.strict_encode64(tempStr).gsub('+', '-').gsub('/', '_').gsub(/#{Regexp.escape('=')}+$/, '')
end

Thanks for the help!

1 Like

Hey @edmodev,

Happy to hear you got it working! Thanks for sharing the ruby code solution! :slight_smile:

-Tommy