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

Stream.promises/pipeline does not support an array of streams starting in 16.10.0. Fixed by 17 #40663

Closed
markddrake opened this issue Oct 30, 2021 · 4 comments
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs. stream Issues and PRs related to the stream subsystem.

Comments

@markddrake
Copy link

Version

16.10.0

Platform

docker node:16:10.0

Subsystem

No response

What steps will reproduce the bug?

The following code


const { pipeline } = require('stream/promises');
const fs = require('fs');

async function main() {

   const streams  = [fs.createReadStream(__filename),os = fs.createWriteStream(__filename + ".copy")]
   await pipeline(streams)

}

main().then(() => {console.log('Success')}).catch((e) => {console.log(e)})

Works in 16.9.0.

In 16.10.0 it fails with

root@6d10d954f21e:/# node test.js
TypeError [ERR_MISSING_ARGS]: The "streams" argument must be specified
    at new NodeError (node:internal/errors:371:5)
    at pipelineImpl (node:internal/streams/pipeline:181:11)
    at node:stream/promises:26:5
    at new Promise (<anonymous>)
    at pipeline (node:stream/promises:17:10)
    at main (/test.js:8:10)
    at Object.<anonymous> (/test.js:12:1)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32) {
  code: 'ERR_MISSING_ARGS'
}
root@6d10d954f21e:/#

In 17.0.1 it works again.

How often does it reproduce? Is there a required condition?

100% in 16.10..

What is the expected behavior?

The code should work.

What do you see instead?

No response

Additional information

I did not see an existing issue for this...

@markddrake
Copy link
Author

If you unpack the array using the ... operator it works in all versions

@Mesteery Mesteery added the duplicate Issues and PRs that are duplicates of other issues or PRs. label Oct 30, 2021
@Mesteery
Copy link
Contributor

Mesteery commented Oct 30, 2021

Yes it is "normal", it was a regression, cf. #40191.

@targos
Copy link
Member

targos commented Oct 31, 2021

This will probably be fixed in the next v16.x release.

@targos targos added the v16.x label Oct 31, 2021
@Mesteery Mesteery added the stream Issues and PRs related to the stream subsystem. label Nov 1, 2021
@targos
Copy link
Member

targos commented Nov 4, 2021

I cherry-picked the fix to v16.x-staging. It will be out in the next release.

36d3b12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs. stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

No branches or pull requests

3 participants