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 · Fixed by #4015
Closed

proxy mishandles network errors #1013

acthp opened this issue Dec 5, 2017 · 5 comments · Fixed by #4015

Comments

@acthp
Copy link

acthp 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
Copy link
Member

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

@brian-mann brian-mann added the stage: needs information Not enough info to reproduce the issue label Dec 5, 2017
@acthp
Copy link
Author

acthp 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
Copy link
Author

acthp commented Dec 6, 2017

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

@jennifer-shehane jennifer-shehane added stage: needs investigating Someone from Cypress needs to look at this and removed stage: needs information Not enough info to reproduce the issue labels Dec 7, 2017
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review and removed stage: needs investigating Someone from Cypress needs to look at this labels May 6, 2019
@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels May 15, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot 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
Copy link
Contributor

cypress-bot bot 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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants