Crash in OpenVidu.reconnectedCallback on web

I’ve been getting an intermittent issue in when using the openvidu-browser NPM package.

It seems to be that that method isn’t doing a check to see if rpcSessionId is set.

Is there a reason that would not be set? And if not, is there a way to catch for this error or sidestep the issue?

Any help would be appreciated. Thanks!

Hi,

This seems a problem for users with unstable networks that are triggering the “reconnected” event (more info here: https://docs.openvidu.io/en/latest/advanced-features/automatic-reconnection).

The exact line triggering the exception is this one: https://github.com/OpenVidu/openvidu/blob/d039f71fdb2a601d36aa9d864e1bbbafded0e79f/openvidu-browser/src/OpenVidu/OpenVidu.ts#L1028

Object this.session.connection is not defined at this point:

this.sendRequest('connect', { sessionId: this.session.connection.rpcSessionId }, (error, response) => {

Which is a completely unexpected state, as it is impossible to trigger reconnected event without having being connected to the session, process that inevitably leads to the definition of OpenVidu.session.connection object. And there’s no place in the code where Connection object is deleted from Session object once it is set in here after a succesfull connection to the remote session: https://github.com/OpenVidu/openvidu/blob/d039f71fdb2a601d36aa9d864e1bbbafded0e79f/openvidu-browser/src/OpenVidu/Session.ts#L1154

There are 3 things I need from you in order to help you:

  1. Please carefully detail what do you mean in the private message you sent us with this sentence:

The problem doesnt happen 100% of the time, but when it does, it breaks our app.

How does it break your app? An error in the client side in the reconnected handler should not break the entire app, at most it should fail automatically reconnecting that specific user to the session and that’s all. Never ever should crash your entire app.

  1. It would be very useful a complete log of openvidu-browser, not only the error. Capturing the entire browser’s console from this exact line:
'OpenVidu' initialized

Until this error is triggered. So something like this:

That way we will have more context of the actions taken by openvidu-browser before the error takes place. Probably enabling “Verbose” log level will be useful too:

image

  1. I need a way to consistently replicate the error to see if there’s any kind of problem under the hood. Can you describe the steps to reproduce the error?

Regards.