Can't connect another user (InvalidStateError)

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

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

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,…