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: '',
  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:

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

Other possible solutions that may work:

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

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

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

Receive updates via email

Other Posts

Updated Posts