-
-
Notifications
You must be signed in to change notification settings - Fork 536
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
Mocked stream response with multiple enqueues hangs process #2051
Comments
With the reproduction example, I'm largely copying directly from the documented example: https://mswjs.io/docs/recipes/streaming Strangely, calling Using |
Hi, @aduth. Thanks for reporting this! Interesting. Your use case looks almost identical to this test we have passing: msw/test/node/rest-api/response/body-stream.node.test.ts Lines 23 to 50 in 313691b
Does anything different catch your eye between these two? We should certainly support pushing as many chunks as you need. |
Can you try this on the latest minor version of Node.js v18? I could reproduce your issue on v18.14.2 but the issue is gone on v18.19.0. Node.js can have issues too! In fact, there have been a few in the past that broke |
I just re-tested on latest versions of Node.js 18 and 20 (18.19.1 and 20.11.1) and unfortunately still seems to hang in both versions. Regarding your comment on the similarities, yes, I tried code adapted both from documentation and from those exact tests to try to use in my project, which is why I was surprised when I found it wasn't working. |
@aduth, quite strange. Your repo passes for me on v18.19. This is very unlikely an issue with MSW. I encourage you to look at Node.js/Unidici issues, especially related to request body cloning. For example, I've reported one today to Node.js (nodejs/node#52167), which is actually an active issue in Undici (nodejs/undici#2413). |
That makes sense. If I find time, I'll try testing on another device to see if it's specific to my machine. In the meantime, fair to assume it's something outside MSW. |
Prerequisites
Environment check
msw
versionNode.js version
20.11.1
Reproduction repository
https://github.com/aduth/msw-repro
Reproduction steps
npm install
node index.js
Current behavior
Output logs "text helloworld" and the process hangs indefinitely.
Expected behavior
Output logs "text helloworld" and the process ends cleanly.
The text was updated successfully, but these errors were encountered: