question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suddenly my client will not get a connection from server.

See original GitHub issue

I have an app (client && server on separate HEROKU servers)… Its been working perfectly for years. Now all the sudden the connection is intermittent. in v4 the error is 400 in v2 the error is cors… Ive tried almost every cors configuration i can think of.

It looks like the client connect and disconnects several times. sometimes the connection sticks but most of the time it disconnects before the frontend can join a room

It works perfectly with almost any configuration on localhost at all times

Client ==> “socket.io-client”: “^4.4.1”,

this.socket = io(environment.backend, {
      withCredentials: true,
      extraHeaders: { dash: "abcd" },
    });

Server ==> “socket.io”: “^4.4.1”,

this.io = new Server(server, {cors: { 
          origin: env.frontend_url, 
          allowedHeaders: ["dash"],
          credentials: true
        }});

often after a confirmed connection there is the following error

websocket.js:54 WebSocket connection to ‘wss://fornida-api.herokuapp.com/socket.io/?EIO=4&transport=websocket&sid=j64x9KB6m87VHUM4AAAJ’ failed:

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
darrachequesnecommented, Jan 18, 2022

@ohabash for the Heroku platform, you can check: https://devcenter.heroku.com/articles/session-affinity

1reaction
darrachequesnecommented, Jan 15, 2022

If it’s an HTTP 400 error, it sounds like a “Session ID unknown” error, when some requests reach a different Socket.IO server in a multiple servers setup. Are sticky sessions enabled?

See also: https://socket.io/docs/v4/troubleshooting-connection-issues/

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Cannot connect the computer to the server" error message ...
Cannot connect the computer to the server because either another software installation is in progress or, the computer has a restart pending.
Read more >
How to fix the four biggest problems with failed VPN connections
1: The VPN connection is rejected.​​ If the Windows server-powered VPN is rejecting client connections, the first thing you need to do is...
Read more >
How to fix 8 common remote desktop connection problems
First, try to establish a session from a client that has been able to successfully connect in the past. The goal is to...
Read more >
What can be the reasons of connection refused errors?
A firewall between the client and server is blocking access (also check local firewalls). After checking for firewalls and that the port is...
Read more >
How to Troubleshoot SSH Connectivity Issues
Verify that you can resolve the hostname on your client machine using the system ping command. Using third-party sites like WhatsMyDns.net to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found