Server unhealthy Exited with status 1 while running your code

Hi all,

My node.js project runs but then fails shortly after.

Here is the log:

/opt/render/project/src/node_modules/ws/lib/websocket-server.js:340
Nov 11 11:56:02 AM        throw new Error(
Nov 11 11:56:02 AM        ^
Nov 11 11:56:02 AM  
Nov 11 11:56:02 AM  Error: server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration
Nov 11 11:56:02 AM      at WebSocketServer.completeUpgrade (/opt/render/project/src/node_modules/ws/lib/websocket-server.js:340:13)
Nov 11 11:56:02 AM      at WebSocketServer.handleUpgrade (/opt/render/project/src/node_modules/ws/lib/websocket-server.js:316:10)
Nov 11 11:56:02 AM      at /opt/render/project/src/node_modules/engine.io/build/server.js:397:21
Nov 11 11:56:02 AM      at Server.verify (/opt/render/project/src/node_modules/engine.io/build/server.js:127:24)
Nov 11 11:56:02 AM      at Server.handleUpgrade (/opt/render/project/src/node_modules/engine.io/build/server.js:383:14)
Nov 11 11:56:02 AM      at Server.<anonymous> (/opt/render/project/src/node_modules/engine.io/build/server.js:495:26)
Nov 11 11:56:02 AM      at Server.emit (events.js:388:22)
Nov 11 11:56:02 AM      at onParserExecuteCommon (_http_server.js:699:14)
Nov 11 11:56:02 AM      at onParserExecute (_http_server.js:612:3)

Any thoughts on what is causing the problem.

Hello,

From what I can see this appears to be an issue with the application. I found a few articles that might help point you in the right direction:

A Node community might have more expertise in getting this configured correctly. If you discover anything that seems to be a Render-specific issue don’t hesitate to file a support ticket.

Regards,

Matt

Thanks Matt, the thing is this code works fine on AWS server so it doesn’t seem to be a Node.js issue, and its more of a Render.com issue i fear.

Looks like setting “noServer: true” in the code resolved this issue.

const io = new WebSocket.Server({ noServer: true });
global.io = new WebSocket.Server({ noServer: true });

Hope that helps someone else in the community if they come across this.

I also have this same error Exited with status 1 while running your code
But here I am deploying a web service. I am attaching images below. Please respond if you have a solution to this.