# Can't connect another user (InvalidStateError)

**URL:** <https://openvidu.discourse.group/t/cant-connect-another-user-invalidstateerror/3362>\
**Category:** Issues developing apps\
**Tags:** v2\
**Created:** [September 7, 2021, 12:54pm UTC](https://openvidu.discourse.group/t/cant-connect-another-user-invalidstateerror/3362 "2021-09-07T12:54:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luckyluke](https://avatars.discourse-cdn.com/v4/letter/l/53a042/32.png) [@luckyluke](https://openvidu.discourse.group/u/luckyluke)\
**Post date:** [September 7, 2021, 12:54pm UTC](https://openvidu.discourse.group/t/cant-connect-another-user-invalidstateerror/3362/1 "2021-09-07T12:54:11Z")

</div>

Some details that may be irrelevant:  
Im using firefox  
All users have Publisher role except from the session’s creator that has Moderator role.  
Every user publishes his camera (session.publish() on the frontend)  
I log in twice on the same pc for this test

I open a firefox window and i log in the session. Everything works fine and i see my camera.  
Then i open a private window and i log in with another username on the same session.  
The user on the first window(the moderator) sees nothing at all. However as i see, openvidu sends some events on the console caused by the second user.  
Now, the second user on the private window (with publisher role) see his camera only for a few seconds. He also sees the moderator’s username!  
After one or two seconds, the second user gets this error

 ![Screenshot from 2021-09-07 15-48-19](https://global.discourse-cdn.com/free1/uploads/openvidu/original/2X/3/320b3d269d8c9b1765c435702d2b7da50514ae51.png)

Here are also some first errors that are printed on the second user’s console.

 ![Screenshot from 2021-09-07 15-50-56](https://global.discourse-cdn.com/free1/uploads/openvidu/original/2X/7/72c96933aa2c586927d98ac4d18a00d5441fb783.png)

For the frontend i use React. It would be possible that i’m doing something wrong with react but i really have not a clue what it could be.

It’s interesting to say that i tried to connect the two users many times and one time it worked! I could see both cameras with the two different usernames.

Could this be an openvidu issue?

EDIT: I forgot to post the error from the openvidu server. Here it is–

[ERROR] 2021-09-07 14:07:04,810 [SessionHandler-qjojl334qrjk6q5a5gh22liioj-e8-t0] org.kurento.jsonrpc.internal.JsonRpcHandlerManager - Exception while processing request {“id”:62,“method”:“onIceCandidate”,“params”:{“endpointName”:“con\_JKAC3nJRTa”,“candidate”:"",“sdpMid”:“1”,“sdpMLineIndex”:1},“jsonrpc”:“2.0”}  
io.openvidu.client.OpenViduException: No session information found for participant with privateId qjojl334qrjk6q5a5gh22liioj. Method ‘Session.connect()’ must be the first operation called in any session. Code: 803  
at io.openvidu.server.rpc.RpcHandler.handleRequest(RpcHandler.java:110)  
at org.kurento.jsonrpc.internal.JsonRpcHandlerManager.handleRequest(JsonRpcHandlerManager.java:142)  
at org.kurento.jsonrpc.internal.server.ProtocolManager$3.run(ProtocolManager.java:218)  
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)  
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)  
at java.base/java.lang.Thread.run(Thread.java:829)

EDIT 2:  
I’m fooling around with the react code. I changed this code  
session.on(“streamCreated”, (event) =\> {  
let subscriber = await session.subscribe(event.stream, undefined);  
let subscribersUpdatedList = […subscribers, subscriber];  
setSubscribers(subscribersUpdatedList);  
});  
to this code  
session.on(“streamCreated”, async (event) =\> {  
let subscriber = await session.subscribeAsync(event.stream, undefined);  
let subscribersUpdatedList = […subscribers, subscriber];  
setSubscribers(subscribersUpdatedList);  
});

but now i’m getting this error on my screen:  
Unhandled Rejection (Error): Error on publishVideo: {“request”:"{“jsonrpc”:“2.0”,“method”:“publishVideo”,“params”:{“doLoopback”:false,…

and this error(only the first one, others appear after it) on the console:  
ERROR:Request has timed out in Request: method:publishVideo params:{“doLoopback”:false,…
