-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
stream: using an async iterator on a pipeline works on v18 but in v19 needs Readable.from(asyncItFn) #46141
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Adding |
@mcollina the problem here is all the global stream init logic lives in 'stream', so at the moment you must first import 'stream' before anything else under 'stream/...' |
OMG 😂 I'd like to help working on it. Do you know where to look at? |
node/lib/stream.js |
do other bugs are happening because of it? |
Analyzing here it works without going on 'node:stream/promises': import { promises } from 'node:stream'
const { pipeline } = promises
async function* myCustomReadable() {
yield Buffer.from(`tick: ${new Date().toISOString()}`)
}
async function* myCustomWritable(stream) {
for await (const chunk of stream) {
console.log(chunk.toString())
}
}
await pipeline(
myCustomReadable,
myCustomWritable,
) But looking at the code, here is the problem: if I change from Gonna take a look at it tonight |
Since v19.2 it's not possible to use readableStreams as async iterators (confirmed bug). This patch fixes the problem by reading the Stream.Duplex property from 'streams/duplex' instead of 'streams/legacy' module Fixes: nodejs#46141
Since v19.2 it's not possible to use readableStreams as async iterators (confirmed bug). This patch fixes the problem by reading the Stream.Duplex property from 'streams/duplex' instead of 'streams/legacy' module Fixes: #46141 PR-URL: #46147 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Since v19.2 it's not possible to use readableStreams as async iterators (confirmed bug). This patch fixes the problem by reading the Stream.Duplex property from 'streams/duplex' instead of 'streams/legacy' module Fixes: #46141 PR-URL: #46147 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Since v19.2 it's not possible to use readableStreams as async iterators (confirmed bug). This patch fixes the problem by reading the Stream.Duplex property from 'streams/duplex' instead of 'streams/legacy' module Fixes: #46141 PR-URL: #46147 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Since v19.2 it's not possible to use readableStreams as async iterators (confirmed bug). This patch fixes the problem by reading the Stream.Duplex property from 'streams/duplex' instead of 'streams/legacy' module Fixes: #46141 PR-URL: #46147 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Version
19.3
Platform
darwin
Subsystem
No response
What steps will reproduce the bug?
The code below works on
v18.13.0
but crashes onv19.3.0
but it works if explicitly convert it to a Readable
How often does it reproduce? Is there a required condition?
No response
What is the expected behavior?
No response
What do you see instead?
TypeError: Right-hand side of 'instanceof' is not an object
Additional information
@nodejs/streams @nodejs/tooling
The text was updated successfully, but these errors were encountered: