'Cypress + ECONNRESET

We've suddenly been having an issue with cypress automation, and it is impacting a number of people / different pc's.

It will run then stop with this error

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)

Details...

Cypress Version 9.5.0 (but we have rolled back all the way to 9.2 and issue is present in all)

Node.js Version 16 (again, we've rolled back various version of Node 16 and tried 17)

Browser - Edge, Chrome, Firefox, all have this issue, (ONLY electron will run and stay alive)

Our Infrastructure team has helped roll back patching, group policy, proxy has been opened.....to the point its a standard pc with a direct connection to internet and the issue is still present.

Running Cypress in Debug mode gives us...

  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.0","osName":"win32","osVersion":"10.0.19043","osCpus":[{"model":"Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz","speed":4008,"times":{"user":35718,"nice":0,"sys":34734,"idle":522062,"irq":1421}},{"model":"Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz","speed":4008,"times":{"user":26468,"nice":0,"sys":18562,"idle":547484,"irq":171}},{"model":"Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz","speed":4008,"times":{"user":48437,"nice":0,"sys":32609,"idle":511328,"irq":250}},{"model":"Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz","speed":4008,"times":{"user":29453,"nice":0,"sys":15000,"idle":547921,"irq":281}},{"model":"Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz","speed":4008,"times":{"user":36593,"nice":0,"sys":20656,"idle":535125,"irq":187}},{"model":"Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz","speed":4008,"times":{"user":50828,"nice":0,"sys":13906,"idle":527640,"irq":234}},{"model":"Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz","speed":4008,"times":{"user":37796,"nice":0,"sys":19703,"idle":534875,"irq":46}},{"model":"Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz","speed":4008,"times":{"user":27937,"nice":0,"sys":13546,"idle":550890,"irq":140}}],"osMemory":{"free":26111950848,"total":34228842496}},"headers":{"x-os-name":"win32","x-cypress-version":"9.5.0"}} and token: undefined +0ms
  cypress:network:agent addRequest called { isHttps: true, href: 'https://api.cypress.io/exceptions' } +11s
  cypress:network:connect beginning getAddress { hostname: 'api.cypress.io', port: 443 } +14s
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)

https://api.cypress.io has been opened up in the proxy and even bypassing the proxy completely so the pc has a direct connection to the internet still had the same result.

Any suggestions?



Solution 1:[1]

The way we got by this is to use Electron as your default browser to run your test. This will not get blocked by your antivirus.

Solution 2:[2]

Update... Resolved (for us at least) after a process of elimination removing various apps / policies etc, we identified there was a setting within anti-virus that was scanning and interfering with internet traffic (how it got turned on who knows as our infra is so tightly controlled). Turned this off and it all started working as expected.

Solution 3:[3]

It is possible to opt out of sending information to https://api.cypress.io/exceptions by setting the environment variable CYPRESS_CRASH_REPORTS=0

See this link for more information: https://github.com/cypress-io/cypress/issues/4386

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 Jimmy
Solution 2 Biking-Monkey
Solution 3 Pieter Roodt