-
Notifications
You must be signed in to change notification settings - Fork 762
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
[fix] write EPIPE error when attaching a file. (small repro) #830
Comments
@eddienubes have you found a solution to this issue? |
@ajfranzoia Hilariously, I've just created my own http testing library - https://github.com/eddienubes/sagetest |
In my case, the issue occurred when a server responded with an error without reading the stream. if you debug this https://github.com/ladjs/superagent/blob/v9.0.2/src/node/index.js#L1211 line you find that data continued to write even after the request had completed, leading to an EPIPE error. It's reproducible on node >=18. |
@rawmind This tracks with what I'm seeing: in my case the intermittent failure I encounter is on a negative testcase where supertest calls Any guesses how to avoid it, other than maybe changing the server to consume bad request data? |
In our case, the test that fails verifies that a 400 is returned when a too large file is uploaded. The endpoint inspects the |
Describe the bug
Node.js version: v20.11.0
OS version: macOS Sonoma 14.2.1
Description:
When trying to attach 2 cat images (7mb and 560kb) node throws "write EPIPE" error.
The list of facts:
A test snippet:
When I run ~14 of these in a single test suite the error occurs. (The test suit in the repro)
Also, for simplicity of this test suite I didn't use any multipart/form-data parser.
Perhaps, connected to #824 or #491.
We're unable to upgrade our repo with thousands of tests from v16 to v20 or even v18 because of this. Not sure how to proceed. Any advice will be highly appreciated!
Actual behavior
Node throws write EPIPE error supposedly due to how supertest handles streaming of these files.
Expected behavior
Should upload files without this error occurring.
Code to reproduce
A small repo with a test to reproduce the issue:
https://github.com/eddienubes/supertest-write-epipe-bug-repro
Checklist
The text was updated successfully, but these errors were encountered: