Skip to content

test: reproduce Node 25 upload duplex failure - #949

Draft
KnightNiwrem wants to merge 1 commit into
v2from
test/node25-upload-duplex
Draft

KnightNiwrem wants to merge 1 commit into
v2from
test/node25-upload-duplex

Conversation

@KnightNiwrem

Copy link
Copy Markdown
Member

Note

This PR was primarily written by GPT-5.6 Sol xhigh in ChatGPT Work.

Summary

This test-only draft PR adds a Node 25 CI reproduction for file uploads through the public API:

  • constructs a normal Api instance
  • calls api.sendDocument
  • supplies https://grammy.dev/images/Y.svg through InputFile
  • does not use a fetch stub, mock server, real bot token, or real chat identifier

The local TypeScript source is bundled first so that the request itself is executed by Node 25 rather than Deno.

Current result

The sendDocument call fails before making a network request:

HttpError: Network request for 'sendDocument' failed!
RequestInit: duplex option is required when sending a body.

Node rejects the multipart ReadableStream request body because the generated RequestInit does not contain duplex: "half".

Why this reproduction matters

The v2 branch changed from node-fetch to Node's native fetch implementation backed by Undici. It might therefore appear that the previous duplex handling is no longer necessary or that Undici supplies it automatically.

This reproduction demonstrates that the runtime change did not solve the requirement. Node 25's Undici still rejects grammY's streaming multipart body unless duplex: "half" is present.

The corresponding default was added on main by #913. The behavior covered by that fix remains necessary in v2 despite the fetch implementation change.

The placeholder token and chat identifier are never validated because request construction fails before any connection is attempted.

Purpose

This PR intentionally contains no production fix. It exists so CI can record the failure through the normal Api.sendDocument path and so the appropriate v2 fix can be discussed separately. It should not be merged in its current failing state.

@KnorpelSenf KnorpelSenf added the v2 related to grammY 2.0 label Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 related to grammY 2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants