Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions web/services/coderouter/opencodeProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -808,8 +808,12 @@ function pinnedFetch(pin: ProviderPin): typeof fetch {
});
outgoing.on("error", reject);
if (body) {
// pipeline destroys the request when the client body fails.
pipeline(Readable.fromWeb(body as import("node:stream/web").ReadableStream), outgoing, (error) => {
// pipeline destroys the request when the client body fails. The body
// is read as an async iterable, not through Readable.fromWeb: Bun
// 1.3's fromWeb throws a source stream error as an uncaught
// exception instead of passing it to pipeline.
const source = Readable.from(body as import("node:stream/web").ReadableStream<Uint8Array>, { objectMode: false });
pipeline(source, outgoing, (error) => {
if (error) reject(error);
});
} else {
Expand Down
Loading