Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proxy mishandles network errors #1013

Closed
acthp opened this issue Dec 5, 2017 · 5 comments

Comments

3 participants
@acthp
Copy link

commented Dec 5, 2017

Current behavior:

Connection refused errors, that should fail in a fraction of a second, are instead returned as timeouts, after 30s.

Desired behavior:

Return error 'connection refused' on connection refused, at the time the connection is refused.

How to reproduce:

In the test app, make an ajax request to port that isn't listening. Outside cypress, it should fail immediately with connection refused. In cypress, it will fail after half a minute with timeout.

Additional Info (images, stack traces, etc)

  • Operating System: ubuntu 14.04
  • Cypress Version: 1.1.3
  • Browser Version: chrome 60
@brian-mann

This comment has been minimized.

Copy link
Member

commented Dec 5, 2017

Can you provide a reproducible example? The reason I ask is that given the description, I know that there must be more to this problem.

The Cypress proxy most definitely works as intended in these scenarios. A very simple and quick test results in the immediate returning of those network requests in the case of ECONNREFUSED.

Here's both an image and an XHR failing as intended.

screen shot 2017-12-05 at 4 40 40 pm

Timings:

screen shot 2017-12-05 at 4 40 37 pm


screen shot 2017-12-05 at 4 40 14 pm

Timings:

screen shot 2017-12-05 at 4 40 27 pm

@acthp

This comment has been minimized.

Copy link
Author

commented Dec 6, 2017

This can be tested by opening a second tab in the cypress-controlled browser, and loading this file (making sure nothing is listening on port 1234).

<html><body><script>
window.onload = function () {
	console.log('hello');
	var xhr = new XMLHttpRequest();
// This case should return connection refused, but instead returns server 500.
//	xhr.open('GET', 'http://localhost:1234/');
// This case should return connection refused, but hangs for 30s and returns timeout.
	xhr.open('GET', 'https://localhost:1234/');
	xhr.onreadystatechange = function() {
		console.log('got status', xhr.status);
	};
	xhr.send();
}

</script></body></html>
@acthp

This comment has been minimized.

Copy link
Author

commented Dec 6, 2017

Also, verified same behavior on OSX 10.10 with chrome 62.

@cypress-bot

This comment has been minimized.

Copy link

commented May 15, 2019

The code for this is done in cypress-io/cypress#4015, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot

This comment has been minimized.

Copy link

commented May 17, 2019

Released in 3.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.