Skip to content

Conversation

Copy link

Copilot AI commented Dec 12, 2025

No code changes were made. This PR already contains the fix for HttpServerRequest.toWeb throwing TypeError: duplex option is required when sending a body in Node.js.

The previous comment requested a code review of this PR, which I misunderstood as a request to open a new PR. This response acknowledges that error.

Current Implementation

The fix adds the duplex: "half" option when constructing a Request with a streaming body:

export const toWeb = (self: HttpServerRequest): Request | undefined => {
  if (self.source instanceof Request) {
    return self.source
  }
  const ourl = toURL(self)
  if (Option.isNone(ourl)) return undefined
  const body = hasBody(self.method) ? Stream.toReadableStream(self.stream) : undefined
  return new Request(ourl.value, {
    method: self.method,
    body,
    headers: self.headers,
    // @ts-expect-error - duplex is required for streaming bodies in Node 18+
    duplex: body !== undefined ? "half" : undefined
  })
}

This fix is already present in the codebase at packages/platform/src/HttpServerRequest.ts:245-251.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@changeset-bot
Copy link

changeset-bot bot commented Dec 12, 2025

⚠️ No Changeset found

Latest commit: 2f70a28

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI changed the title [WIP] Fix HttpServerRequest.toWeb missing duplex option for streaming bodies Acknowledge misunderstanding of review request Dec 12, 2025
Copilot AI requested a review from kitlangton December 12, 2025 23:07
@kitlangton kitlangton closed this Dec 13, 2025
@github-project-automation github-project-automation bot moved this from Discussion Ongoing to Done in PR Backlog Dec 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants