[X] I've searched for any related issues and avoided creating a duplicate issue.
Description
If you create a server like const wss = new WebSocketServer({ noServer: true }); and then call wss.address() in a "connection" listener, the server throws this error: 'The server is operating in "noServer" mode'.
I spent a few hours trying to track down why I couldn't get authentication working in an HTTP upgrade handler, only to discover the real problem was that I had a piece of dead code somewhere else that was causing an error (my error handling destroyed the socket).
It would help if the error thrown in address() could be rewritten as 'Cannot return address. The server is operating in "noServer" mode' or just return null.
Is there an existing issue for this?
Description
If you create a server like
const wss = new WebSocketServer({ noServer: true });
and then callwss.address()
in a"connection"
listener, the server throws this error:'The server is operating in "noServer" mode'
.I spent a few hours trying to track down why I couldn't get authentication working in an HTTP upgrade handler, only to discover the real problem was that I had a piece of dead code somewhere else that was causing an error (my error handling destroyed the socket).
It would help if the error thrown in
address()
could be rewritten as'Cannot return address. The server is operating in "noServer" mode'
or just returnnull
.ws version
Current
Node.js Version
v18.17.1
System
MacOS Sonoma
Expected result
No response
Actual result
No response
Attachments
No response