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 doesn't support arrays of streams since node 16.10 #40191

Closed
darksabrefr opened this issue Sep 23, 2021 · 0 comments
Closed
Labels
confirmed-bug Issues with confirmed bugs. stream Issues and PRs related to the stream subsystem.

Comments

@darksabrefr
Copy link

darksabrefr commented Sep 23, 2021

Version

v16.10.0

Platform

5.8.0-63-generic #71-Ubuntu SMP Tue Jul 13 15:59:12 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

stream/promises

What steps will reproduce the bug?

'use strict';

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

(async () => {
    await pipeline([
        async function * () {
            yield 'a';
            yield 'b';
            yield 'c';
        },
        async function (source) {
            for await (const chunk of source) {
               console.log(chunk)
            }
        }
    ]);
})();

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

Always in 16.10, never in 16.9

What is the expected behavior?

It should output:

a
b
c

What do you see instead?

node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^

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)
    [...] {
  code: 'ERR_MISSING_ARGS'
}

Additional information

Starting with node 16.10, the promise version of pipeline doesn't handle this signature:pipeline(streams), where streams is <Stream[]> | <Iterable[]> | <AsyncIterable[]> | <Function[]> according to the documentation.
I think the problem is related with the introduction of the signal parameter, possibly with this change: 97f3072ceb#diff-241fa22640048b6a147dec92f1ebf253043a1c4c342c7e52402112eb3c58f8fbL35
The callback version of stream.pipeline is not affected.
Related PR :

@Mesteery Mesteery added the stream Issues and PRs related to the stream subsystem. label Sep 23, 2021
Mesteery added a commit to Mesteery/node that referenced this issue Sep 23, 2021
@Mesteery Mesteery added the confirmed-bug Issues with confirmed bugs. label Sep 23, 2021
targos pushed a commit that referenced this issue Oct 20, 2021
Fixes: #40191

PR-URL: #40193
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
kirillgroshkov added a commit to NaturalCycles/nodejs-lib that referenced this issue Oct 26, 2021
targos pushed a commit that referenced this issue Nov 4, 2021
Fixes: #40191

PR-URL: #40193
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
JustinGrote added a commit to pester/vscode-adapter that referenced this issue Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants