Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

386
Views
Socket.io throw connect_error "server error" after moving to a different domain name

This is the extension of my last question here:

socket.io always has connection false

For now, I have two servers deployed in two different domain names. The first server works perfectly fine with socket.io, so I redeployed the server to the new domain name by simply pull the same branch from GitHub, install everything and run it. And then I found that all my socket.io connections failed and the symptom is exactly the same as last time: connection always 'false' and disconnection always 'true'.

This time I am pretty sure it is not related with cors, because I tried io.origins((origin, cb) => if (whitelist.includes(origin)) { cb(null, true) } else { cb('failed', false) ) and it shows the origin is allowed.

I also tried cors: { origin: '*' } and that also doesn't work.

Strangely, despite the fact that they are using the same code, connecting to the first domain name works perfectly fine. But the second one has the issue.

UPDATE:

I use this to track the error message.

        this.socket.on('connect_error', function(err) {
            console.log(`connect_error due to ${err.message}`);
        });

And this is what is returned:

connect_error due to server error

In the mean time, on server side I can see nothing other than the new connections being created and being disconnected due to ping timeout.

Where can I find more information to help me debug?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Turns out I forgot to run npm i after deploying to a new domain name. The version of socket.io wasn't updated and caused that issue.

Everyone who sees this, just make sure you have updated the package before you give up on debugging.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!