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.

socket.close() is not a function in Node.js 8.x+

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
DABHcommented, Jul 26, 2019

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.

1reaction
cloverbcommented, Jun 19, 2019

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

Read more comments on GitHub >

github_iconTop 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 >

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