Hi,
I ran into an error where sometimes when running a server, it fails to secure a socket connection. Here's the stack trace:
{ Error: Client network socket disconnected before secure TLS connection was established
at TLSSocket.onConnectEnd (_tls_wrap.js:1088:19)
at Object.onceWrapper (events.js:277:13)
at TLSSocket.emit (events.js:194:15)
at endReadableNT (_stream_readable.js:1103:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
code: 'ECONNRESET',
path: undefined,
host: null,
port: null,
localAddress: undefined }
Killing and starting the server over again fixes it (does not re-occur), but it happens in about 1 in 3 runs, and happens for every request. This is the trace on the server side:
Server[80]: 3 | Using HandlerTunnelChain
Server[80]: 3 | Connecting to upstream proxy...
Server[80]: 3 | Target socket assigned
Server[80]: 3 | Connected to upstream proxy
Server[80]: 3 | Target socket ended
Server[80]: 3 | Target socket closed
Server[80]: 3 | Source socket ended
Server[80]: 3 | Closing handler
Connection 3 closed
{ srcTxBytes: 203,
srcRxBytes: 139,
trgTxBytes: 143,
trgRxBytes: 205 }
Here's the request I'm making (which goes to an upstream proxy provider):
`
const userAgent = new UserAgent();
const userAgentString = userAgent.toString();
var agent = new HttpsProxyAgent(proxy_url);
request(
{
url: "https://example.com",
agent: agent,
method: 'get',
gzip: true,
headers: {
'User-Agent': userAgentString,
}
},
function(err, res, body) {
console.log(err)
}
)
`