Skip to content

stream.promises.pipeline doesn't support arrays of streams since node 16.10 #40191

Closed
@darksabrefr

Description

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 :

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions