3 ms·
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
by zbjornson 8y ago
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.
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.
[0] https://github.com/bitinn/node-fetch/issues/446 https://github.com/bitinn/node-fetch/issues/446
[1] https://github.com/googleapis/nodejs-storage/issues/27 https://github.com/googleapis/nodejs-storage/issues/27 (two different timeout bugs)