'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)


Solution 1:[1]

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.

Solution 2:[2]

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.

Solution 3:[3]

I believe it's something to do with Sophos.

Solution 4:[4]

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.

Solution 5:[5]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tiger Darling
Solution 2
Solution 3 Simon Lam
Solution 4 ouflak
Solution 5 Enlacumbre