3

I was trying to make an external api call using https and got the following error.

Error: Client network socket disconnected before secure TLS connection was established at TLSSocket.onConnectEnd (_tls_wrap.js:1092:19) at Object.onceWrapper (events.js:286:20) at TLSSocket.emit (events.js:203:15) at endReadableNT (_stream_readable.js:1129:12) at process._tickCallback (internal/process/next_tick.js:63:19) code: 'ECONNRESET',

On further investigation I came to know that my api endpoint uses TLSv1.3 and since I am using nodejs 10.x, I need to set tls.DEFAULT_MAX_VERSION = 'TLSv1.3';

after which it is throwing the following error

TypeError [ERR_TLS_INVALID_PROTOCOL_VERSION]: "TLSv1.3" is not a valid maximum TLS protocol version at toV (_tls_common.js:49:9) at new SecureContext (_tls_common.js:74:23) at Object.createSecureContext (_tls_common.js:100:13) at Object.connect (_tls_wrap.js:1127:48) at Agent.createConnection (https.js:120:22) at Agent.createSocket (_http_agent.js:227:26) at Agent.addRequest (_http_agent.js:185:10) at new ClientRequest (_http_client.js:249:16) at request (https.js:289:10) at Object.get (https.js:293:15)

Sandeep Patel
  • 4,815
  • 3
  • 21
  • 37
Shadab Khan
  • 31
  • 1
  • 6

0 Answers0