-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
Closed
restatedev/sdk-typescript
#426Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.web streams
Description
Version
18.7.0
Platform
Microsoft Windows NT 10.0.19044.0 x64
Subsystem
stream
What steps will reproduce the bug?
import { createServer } from 'node:http';
import { Writable } from 'node:stream';
import { once } from 'node:events';
const server = createServer(async (req, nodeStreamResponse) => {
const webStreamResponse = Writable.toWeb(nodeStreamResponse);
});
server.listen({ port: 8080 });
await once(server, 'listening');
await fetch('http://localhost:8080');
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
According to the documentation:
Class: http.ServerResponse extends http.OutgoingMessage
Class: http.OutgoingMessage extends Stream
This means that ServerResponse
fulfilling the contract Writable.toWeb
.
What do you see instead?
TypeError [ERR_INVALID_ARG_TYPE]: The "streamWritable" argument must be an stream.Writable. Received an instance of ServerResponse
at new NodeError (node:internal/errors:387:5)
at Object.newWritableStreamFromStreamWritable (node:internal/webstreams/adapters:99:11)
at Writable.toWeb (node:internal/streams/writable:926:27)
Additional information
Maybe this condition:
if (typeof streamWritable?._writableState !== 'object') {
is too heavy?
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.web streams