-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Request.body does not seem to interface correctly with ReadableStream #3862
Comments
Hmm. Interesting. Remix uses this package to support web streams. Which ultimately uses web-streams-polyfill Here's the line that adds I have a function to convert from node streams to web streams, instead of export function nodeStreamToReadableStream(nodeStream: Readable) {
return new ReadableStream({
start(controller: any) {
nodeStream.on('data', (chunk: any) => {
controller.enqueue(chunk)
})
nodeStream.on('end', () => {
controller.close()
})
},
})
} |
@kiliman I did something similar, I now use
This should probably make sure back pressure and stuff like that get respected. But the actual issue is not that the |
While using the serpapi/serpapi-javascript package (which uses the nodejs/undici HTTP/1.1 client under the hood), imported from a file using the Ultimately
|
Looks like this isn't going to be possible as they rely on privately defined symbols in the Node internals to check if the thing passed to fromWeb / toWeb is valid (here, and here). We do however provide the following functions from the
|
@jacob-ebey Wait, I see that |
I've also encountered this issue, and I'm trying to use |
What version of Remix are you using?
1.6.0
Steps to Reproduce
The
request.body
seems to be a web compatible ReadableStream, but it does not seem to be 100% compatible yet. Reproduce with this:This will yield:
This is not just a TS thing, as casting it will result in runtime error:
Expected Behavior
I expect
request.body
to contain an object of type ReadableStream that fulfills all the properties a standardized web ReadableStream has.I thus expect
Readable.fromWeb()
to takerequest.body
as a valid parameter.Actual Behavior
The ReadableStream
request.body
is not getting accepted byReadable.fromWeb()
.The text was updated successfully, but these errors were encountered: