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

Creating Transform from stream/web.TransformStream emits ERR_INVALID_ARG_TYPE on third write #42157

Closed
isaacs opened this issue Feb 28, 2022 · 0 comments · Fixed by #42161
Closed
Labels
confirmed-bug Issues with confirmed bugs. stream Issues and PRs related to the stream subsystem. web streams

Comments

@isaacs
Copy link
Contributor

isaacs commented Feb 28, 2022

Version

17.6.0

Platform

Darwin moxy.lan 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000 arm64

Subsystem

stream, stream/web

What steps will reproduce the bug?

const { TransformStream: WebTS } = require('stream/web')
const { Transform: NodeTS } = require('stream')

const s = NodeTS.fromWeb(new WebTS())
s.pipe(process.stderr)
s.write(Buffer.from('hello'))
s.write(Buffer.from('hello'))
s.write(Buffer.from('hello'))
s.write(Buffer.from('hello'))
s.write(Buffer.from('hello'))
s.end()

/*
hellonode:events:505
      throw er; // Unhandled 'error' event
      ^

TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object
    at new NodeError (node:internal/errors:372:5)
    at readableAddChunk (node:internal/streams/readable:266:13)
    at Duplex.Readable.push (node:internal/streams/readable:234:10)
    at node:internal/webstreams/adapters:719:20
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Emitted 'error' event on Duplex instance at:
    at emitErrorNT (node:internal/streams/destroy:164:8)
    at emitErrorCloseNT (node:internal/streams/destroy:129:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v17.6.0
*/

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

always

What is the expected behavior?

Should print "hellohellohellohellohello" to stderr.

What do you see instead?

hellonode:events:505
      throw er; // Unhandled 'error' event
      ^

TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object
    at new NodeError (node:internal/errors:372:5)
    at readableAddChunk (node:internal/streams/readable:266:13)
    at Duplex.Readable.push (node:internal/streams/readable:234:10)
    at node:internal/webstreams/adapters:719:20
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Emitted 'error' event on Duplex instance at:
    at emitErrorNT (node:internal/streams/destroy:164:8)
    at emitErrorCloseNT (node:internal/streams/destroy:129:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v17.6.0

Additional information

No response

@VoltrexKeyva VoltrexKeyva added stream Issues and PRs related to the stream subsystem. web streams labels Feb 28, 2022
@aduh95 aduh95 added the confirmed-bug Issues with confirmed bugs. label Mar 1, 2022
nodejs-github-bot pushed a commit that referenced this issue Mar 3, 2022
Fix: #42157

PR-URL: #42161
Fixes: #42157
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
sxa pushed a commit to sxa/node that referenced this issue Mar 7, 2022
Fix: nodejs#42157

PR-URL: nodejs#42161
Fixes: nodejs#42157
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
danielleadams pushed a commit that referenced this issue Apr 21, 2022
Fix: #42157

PR-URL: #42161
Fixes: #42157
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
danielleadams pushed a commit that referenced this issue Apr 24, 2022
Fix: #42157

PR-URL: #42161
Fixes: #42157
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
danielleadams pushed a commit that referenced this issue Apr 24, 2022
Fix: #42157

PR-URL: #42161
Fixes: #42157
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
danielleadams pushed a commit that referenced this issue Apr 24, 2022
Fix: #42157

PR-URL: #42161
Fixes: #42157
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
xtx1130 pushed a commit to xtx1130/node that referenced this issue Apr 25, 2022
Fix: nodejs#42157

PR-URL: nodejs#42161
Fixes: nodejs#42157
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
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. web streams
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants