NodeJS Error: Socket Hang Up (ECONNRESET)

Posted on September 9, 2019 at 2:46 pm

Users have reported this ECONNRESET error with request.get():

Error: { Error: socket hang up
    at TLSSocket.onHangUp (_tls_wrap.js:1137:19)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
    at TLSSocket.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  code: 'ECONNRESET',
  path: null,
  host: 'google.com',
  port: 443 }

It seems to happen when you make too many concurrent GET requests.

I noticed it may happen only when doing GET/POST requests on HTTPS (SSL) websites.

Looks like it may be fixed with this method:

https://github.com/nodejs/node/issues/9845#issuecomment-264032107

“Adding ciphers: ‘DES-CBC3-SHA’ to the request options seems to fix it in my case.”

Other possible solutions that may work:

https://github.com/request/request/issues/2047#issuecomment-275304197

“a properly formed URL based on one of my algorithms, was actually malformed”

https://github.com/request/request/issues/2047#issuecomment-339734877

“use environment variable NO_PROXY=”yourcompany.com” as well as strictSSL:false”

https://github.com/request/request/issues/2047#issuecomment-338998143

“Add process.env.NODE_TLS_REJECT_UNAUTHORIZED = “0”;”

Receive updates via email

Other Posts

Updated Posts