SocketError: other side closed

See original GitHub issue

Upon connecting to a proxy with user:pass it’s all good, but when I try to make a request to an proxy which is IP authenticated, I get ‘SocketError: other side closed’. I’m not sending the proxy-authorization header as it’s not needed. Blanked the proxy ip and port below.

var Client = require('undici');
(async ()=>{
	const client = new Client("http://proxyip:proxyport")
	const response = await client.request({
	  method: 'GET',
	  path: 'https://api.ipify.org?format=json',
	  headers: {
	    //'proxy-authorization': `Basic ${Buffer.from(':').toString('base64')}`
	  }
	})

	response.body.setEncoding('utf8')
	let data = ''
	for await (const chunk of response.body) {
	  data += chunk
	}
	//
	console.log(response.statusCode)
	console.log(JSON.parse(data))

	client.close()
})();

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:34 (25 by maintainers)

github_iconTop GitHub Comments

1reaction
mcollinacommented, May 22, 2021

Alright, I will see if I can narrow it down.

Thanks! Tracking down those conditions is hard 😦.

1reaction
MoritzLoewensteincommented, May 21, 2021

Alright, I will see if I can narrow it down.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to know when the socket on the other side is closed
When a recv returns 0 bytes, it means the other side has closed (or is in the process of closing) the connection. You...
Read more >
What Is a Socket Error? (with pictures) - EasyTechJunkie
The other side of the connection, the second computer or server, cannot be fixed by the person making the socket connection. Common reasons...
Read more >
Hardhat deploy script on RSK throws UND_ERR_SOCKET
npx hardhat run scripts/deploy.js --network rsk SocketError: closed at Socket. ... It happens on two different synced local RSKJ nodes, ...
Read more >
How to solve "An existing connection was forcibly closed by a ...
SocketException (10054): An existing connection was forcibly closed by a remote host. at System.Net.Sockets.Socket.
Read more >
Socket error 10054 - Connection was reset by the other side!
Sometimes the sessions are closed, the transfer is not completed, sometimes the messages are transferred. I will write below some examples from ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found