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

Socket hang up / ECONNRESET errors with Node.js 20.x #594

Closed
bkimminich opened this issue Oct 17, 2023 · 4 comments · Fixed by #597 · May be fixed by #595
Closed

Socket hang up / ECONNRESET errors with Node.js 20.x #594

bkimminich opened this issue Oct 17, 2023 · 4 comments · Fixed by #597 · May be fixed by #595

Comments

@bkimminich
Copy link
Contributor

With Node.js 20.x previously working and otherwise unchanged Frisby tests start failing with either

Summary of all failing tests
...
    FetchError: request to http://localhost:3000/rest/user/login failed, reason: socket hang up

      at ClientRequest.<anonymous> (node_modules/node-fetch/lib/index.js:1501:11)

(Example: https://github.com/juice-shop/juice-shop/actions/runs/6539449747/job/17758607028#step:6:387)
or

Summary of all failing tests
...
    FetchError: request to http://localhost:3000/rest/user/login failed, reason: read ECONNRESET

      at ClientRequest.<anonymous> (node_modules/node-fetch/lib/index.js:1501:11)

(Example: https://github.com/juice-shop/juice-shop/actions/runs/6539449747/job/17758607313#step:6:579)
errors.

This is very likely related to changes in node-fetch and/or Node.js internal connection handling. This behavior is fully reproducible and deterministic. It is not limited to specific test cases, as disabling or removing the failing test will simply make another test fail from the same error. This can be repeated until no more tests are left... (which solves the problem, but not in a good way... 🤣)

For reproduction steps of the above failing suites, please see juice-shop/juice-shop#2068.

@bkimminich
Copy link
Contributor Author

Likely related issues we identified are

❓Can other Frisby.js users confirm the behavior? If Node.js 20.x works fine for you, could you please provide a link to your working Frisby.js setup with Node.js 20.x?

bkimminich added a commit to bkimminich/frisby that referenced this issue Oct 20, 2023
@koooge
Copy link
Collaborator

koooge commented Oct 23, 2023

I guess this relates to node-fetch/node-fetch#1765 which is fixed in node-fetch@2.6.13.

@koooge
Copy link
Collaborator

koooge commented Oct 23, 2023

Are you using frisby@2.1.3? Although this issue should be fixed by #597, frisby actually has not been released for a long time. Please follow #593. Otherwise, please use the commit hash of the latest master instead.

@koooge koooge closed this as completed Oct 23, 2023
@bkimminich
Copy link
Contributor Author

Just updating node-fetch does not remediate the issue, at least it didn't for me. Only closing the connection did fix it permanently. And funny enough it wasn't enough to add the header via the global setup configuration. Not sure if there's some timing/race condition happening, but the the only stable test executions I was able to get, was from my fork... 🤷‍♂️

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.

2 participants