socket.close() is not a function in Node.js 8.x+
See original GitHub issueI found that logging stopped after leaving the process running for some time. This error was printed to the local console:
[winston] Attempt to write logs with no transports {"level":"error","message":"Error getting objectsForIDs:"}
Jun 18 20:26:02 ip-172-31-11-65 nodejs[8718]: Unhandled rejection TypeError: this.socket.close is not a function
Jun 18 20:26:02 ip-172-31-11-65 nodejs[8718]: at _close (/.../node_modules/winston-syslog/lib/winston-syslog.js:201:23)
Jun 18 20:26:02 ip-172-31-11-65 nodejs[8718]: at Syslog.close
There is no close
method documented on net.Socket
here: nodejs.org. There is a destroy
method, though.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:7 (1 by maintainers)
Top Results From Across the Web
how do I close a server in socket.io 1.0? - Stack Overflow
I'm trying to write a close function that I can run in my after function in mocha. My tests pass if I run...
Read more >Net | Node.js v19.3.0 Documentation
Stops the server from accepting new connections and keeps existing connections. This function is asynchronous, the server is finally closed when all connections ......
Read more >WebSocket.close() - Web APIs - MDN Web Docs
The WebSocket.close() method closes the WebSocket connection or ... and the close() method does not discard previously-sent messages before ...
Read more >15 Common Error Codes in Node.js and How to Fix Them
The ETIMEDOUT error is thrown by the Node.js runtime when a connection or HTTP request is not closed properly after some time.
Read more >Client API - Socket.IO
Else, in all other cases (with some build tools, in Node.js or React ... Both the client and the server must use the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve merged the relevant PRs that fix these issues and will cut a v2.2.0. Thanks folks. If you spot other issues related to this, please feel free to open new issues/PRs and I’ll see what I can do.
We’re seeing this issue as well using:
Node 10.14.0 winston 3.2.1 winston-syslog 2.1.0
@knightcode’s patch appears to resolve the issue.
What kind of repo or logs would you need to see to review either of these PRs @DABH @indexzero? https://github.com/winstonjs/winston-syslog/pull/109 https://github.com/winstonjs/winston-syslog/pull/112