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

Converting node streams to web streams throws an error #16087

Closed
leonardoraele opened this issue Dec 31, 2024 · 1 comment
Closed

Converting node streams to web streams throws an error #16087

leonardoraele opened this issue Dec 31, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@leonardoraele
Copy link

leonardoraele commented Dec 31, 2024

What version of Bun is running?

1.1.42+50eec0025

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

What steps can reproduce the bug?

Minimum reproducible script:

import { Readable, Writable } from 'node:stream';

Readable.toWeb(process.stdin).pipeTo(Writable.toWeb(process.stdout));

What is the expected behavior?

The script should run without errors. It should echo the input into the output.

What do you see instead?

$ npx bun main.ts
1 | import { Readable, Writable } from 'node:stream';
2 |
3 | Readable.toWeb(process.stdin).pipeTo(Writable.toWeb(process.stdout));
                                                  ^
TypeError: lazyWebStreams().newWritableStreamFromStreamWritable is not a function. (In 'lazyWebStreams().newWritableStreamFromStreamWritable(streamWritable)', 'lazyWebStreams().newWritableStreamFromStreamWritable' is undefined)
      at node:stream:2941:66
      at C:\Users\Leonardo Raele\Workspace\testapp\src\main.ts:3:47

Bun v1.1.42 (Windows x64)

Additional information

The script works on Node:

$ node --import=tsx .\src\main.ts
Hello
Hello

Piping stdin to stdout without converting to web streams work as expected.

$ npx bun -e "process.stdin.pipe(process.stdout)"
Hello
Hello
@leonardoraele leonardoraele added bug Something isn't working needs triage labels Dec 31, 2024
@leonardoraele leonardoraele changed the title Converting process io streams to web streams crash the app Converting node streams to web streams crash the app Dec 31, 2024
@leonardoraele leonardoraele changed the title Converting node streams to web streams crash the app Converting node streams to web streams throws an error Dec 31, 2024
@Jarred-Sumner
Copy link
Collaborator

Duplicate of #3927

@Jarred-Sumner Jarred-Sumner marked this as a duplicate of #3927 Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants