Timeouts in Node.js HTTP requests I think are one of the most confusing aspects of all of Node.js, in terms of technical details that are critical to successful production operations. The core documentation is poorly worded in some places, and some of the helper libraries make it very difficult to figure out exactly what timeouts are being set. For example, node-fetch (mentioned in the article) had/has a pretty non-sense timeout on the entire request duration [0], and I've seen that blindly propagated into other libraries [1]. When timeouts only happen under error conditions (flaky servers), it's a nightmare to debug.<p>Glad to see this article explain the various timeouts (although I don't see the idle socket timeout mentioned). Huge +1 from me for using node's core http library only and adding explicit, readable timeouts in your own code.<p>[0] <a href="https://github.com/bitinn/node-fetch/issues/446" rel="nofollow">https://github.com/bitinn/node-fetch/issues/446</a><p>[1] <a href="https://github.com/googleapis/nodejs-storage/issues/27" rel="nofollow">https://github.com/googleapis/nodejs-storage/issues/27</a> (two <i>different</i> timeout bugs)
Very nice article. Valuable conclusion as well.<p>Somebody can think that almost every nodejs developer knows what's in <a href="https://nodejs.org/api/index.html" rel="nofollow">https://nodejs.org/api/index.html</a> - but I don't think that's actually true. One of the better tips on how to be a better nodejs developer is to simply read it from top to bottom. It's really not that long and gives valuable insights.<p>Another insight, which I'm exploring recently in node projects, that is somehow related to this, is "debloating" node npms/projects. After looking at dependency tree used by some of my own npms/projects I was surprised (after few seconds of dependencies recursively unfolding themselves), then shocked (even well before they fully resolved).<p>There is something good about many npms being available but there also seems to be something wrong about how dependency tree spreads out - in many cases duplicating functionality, bringing completly unnecessary dependencies and their friends and a lot of "garbage" in general (ie. thousands of test files/fixtures/what not are not necessary but they come to the node_modules party anyway) etc.<p>I'm not trying to say that `npm i` is bad and should be avoided because that would be nonsense - but I'm trying to say that being concious about what it actually does in your npm/project is something valuable, especially for npm authors where those decisions will have multipled effects.