Tiger Darling
Tiger Darling

Reputation: 69

Why does Cypress get ECONNRESET when accessing api.cypress.io port 443?

Cypress is failing whenever it tries to start the browser for any test. The debug output (below) for Cypress says that it makes a request of api.cypress.io at port 443 but that's get rejected with ECONNRESET. This worked fine until yesterday, 3/15/2022.

 cypress:server:api request to url: POST https://api.cypress.io/exceptions with params: {"body":{"err":{"name":"Error","message":"read ECONNRESET","stack":"Error: read ECONNRESET\n    at TCP.onStreamRead (node:internal<stripped-path>stream_base_commons:211:20)\n"},"version":"9.5.2","osName":"win32","osVersion":"10.0.19044","osCpus":[{"model":"Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz","speed":2592,"times":{"user":1742484,"nice":0,"sys":2745609,"idle":83140890,"irq":564140}},{"model":"Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz","speed":2592,"times":{"user":1367906,"nice":0,"sys":770843,"idle":85490125,"irq":12953}},{"model":"Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz","speed":2592,"times":{"user":3082156,"nice":0,"sys":1812125,"idle":82734593,"irq":58062}},{"model":"Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz","speed":2592,"times":{"user":1978218,"nice":0,"sys":1167062,"idle":84483593,"irq":5796}},{"model":"Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz","speed":2592,"times":{"user":1980421,"nice":0,"sys":1389296,"idle":84259156,"irq":58531}},{"model":"Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz","speed":2592,"times":{"user":1058968,"nice":0,"sys":641062,"idle":85928843,"irq":5765}},{"model":"Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz","speed":2592,"times":{"user":1659281,"nice":0,"sys":1226531,"idle":84743062,"irq":15203}},{"model":"Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz","speed":2592,"times":{"user":7150921,"nice":0,"sys":2484828,"idle":77993125,"irq":15234}},{"model":"Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz","speed":2592,"times":{"user":1834953,"nice":0,"sys":1689578,"idle":84104343,"irq":15718}},{"model":"Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz","speed":2592,"times":{"user":1049156,"nice":0,"sys":710531,"idle":85869156,"irq":6703}},{"model":"Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz","speed":2592,"times":{"user":2008078,"nice":0,"sys":2070031,"idle":83550734,"irq":40375}},{"model":"Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz","speed":2592,"times":{"user":1321593,"nice":0,"sys":1019718,"idle":85287531,"irq":8406}}],"osMemory":{"free":13561356288,"total":34093076480}},"headers":{"x-os-name":"win32","x-cypress-version":"9.5.2"}} and token: undefined +0ms
  cypress:network:agent addRequest called { isHttps: true, href: 'https://api.cypress.io/exceptions' } +4s
  cypress:network:connect beginning getAddress { hostname: 'api.cypress.io', port: 443 } +167ms
Error: read ECONNRESET
    at TCP.onStreamRead (node:internal/stream_base_commons:211:20)
 {
  errno: -4077,
  code: 'ECONNRESET',
  syscall: 'read'
}
Error: read ECONNRESET
    at TCP.onStreamRead (node:internal/stream_base_commons:211:20)

Upvotes: 4

Views: 3525

Answers (7)

Jorge Vasquez
Jorge Vasquez

Reputation: 1

In my case the issue was due to the company proxies. The only proxy that would allow cypress to access the page I needed to test, when set was leading to the issue. Since the proxy had a user and pass, I configured a bat file to open cypress via npx cypress open like this:

call set HTTP_PROXY=https://:@Url call set HTTPS_PROXY=https://:@Url npx cypress open

and when I want to open cypress with the temporary usage of that proxy I open cypress via the bat file and it is working.

Upvotes: 0

Sudheer Singh
Sudheer Singh

Reputation: 664

I was also facing this issue and after doing lots of analysis, I found that it is happening because of Antivirus installed on my machine. Particularly due to Sophos. You can find this issue at - https://community.sophos.com/intercept-x-endpoint/f/discussions/134136/sophos-network-threat-detection-is-blocking-cypress-automation-tool

To solve this issue, try to execute your test cases on Electron browser, or contact your admin team and get the password of Sophos and then Login into the Sophos, Go to settings and disable 'Network Threat Protection'

Upvotes: 0

ajling
ajling

Reputation: 61

As I don't have enough of a reputation to upvote or add a comment onto others answers here is what I've found with this issue.

My company uses Sophos as its antivirus and this I can confirm is the cause (at least for me). After speaking with the IT team they gave me the tamper password and I was able to go into the settings and disable 'Network Threat Protection' after doing this I was able to run Cypress with no issues.

*** Update *** I've posted in the Sophos community forums here and while I test out one of the changes that needs to be made for Sophos there does appear to be a workaround (that worked for me) and that is to use the "Electron browser" rather than Chrome, Firefox or Edge.

Upvotes: 5

Tiger Darling
Tiger Darling

Reputation: 69

I finally figured out that Cypress was trying to connect to it's man server which runs the Cypress Dashboard. That's a product that Cypress offers to let you monitor and debug tests that fail in a CI/CD pipeline. I don't remember now how I solve it but we did eventually create an account there. They have a free version.

Upvotes: 0

Enlacumbre
Enlacumbre

Reputation: 3

I'm having the same issue, but I have found no solution for it so far. Just to shed some light, this what I have configured and what I tried:

  • O.S: Windows 10
  • Node version: 16.13.1
  • Cypress version: tried 9.2.0 and 9.5.4
  • Others: I have Sophos on my computer, but no admin rights on it. Also, the issue started just a few days ago for me, while the project I'm working on I've been on it for several weeks.
  • I tried cleaning the cache, but did not solve the issue.
  • I tried creating a new cypress project and run the example tests, and the issue happened as well.

I know this is not an answer as it does not give a solution to the issue, but I hope it may help getting there

Upvotes: 0

Simon Lam
Simon Lam

Reputation: 11

I believe it's something to do with Sophos.

Upvotes: 1

Kratrz
Kratrz

Reputation: 1

This was working fine for me until I tried on March 14th. I get the same behaviour. The browser starts, it runs a little bit and crashes with this error. I was thinking it had to do something with an update on my computer, and I didn't see anyone else have this issue recently until just now.

Upvotes: 0

Related Questions