Correction / scope refinement (apologies for the imprecision in the original report):
The trigger is more specific than "Node 22+ in general". After further testing:
- Standalone Node v24.16.0 using the bundled undici (7.25.0): the manual
Content-Lengthis accepted andcomposio.files.upload()succeeds even with ~700 KB payloads. - Next.js dev server (Node v24.16.0) with
node_modules/.pnpm/undici@7.27.0in the dependency graph: same call, same payload, fails withTypeError: fetch failed(cause:InvalidArgumentError: invalid content-length header,UND_ERR_INVALID_ARG).
Captured cause stack from the failing path:
InvalidArgumentError: invalid content-length header
at processHeader (node_modules/.pnpm/undici@7.27.0/.../lib/core/request.js:421:13)
at new Request (node_modules/.pnpm/undici@7.27.0/.../lib/core/request.js:214:11)
...
at fetch (node:internal/bootstrap/web/exposed-window-or-worker:83:12)
at uploadFileToS3 (.../@composio/core/dist/fileUtils.node-Dq7ebZPC.mjs:320:31)
So the precise statement is:
uploadFileToS3fails on any host that uses (or transitively pulls in)undici@7.27.0or later as the fetch dispatcher.
This is what next@16.2.7 (the version we're on) installs into node_modules. Other frameworks that ship a newer undici than the one Node bundles will be affected the same way; environments using only the Node-bundled undici 7.25.x are not affected yet — but the underlying issue (manually setting Content-Length is rejected by undici's isValidContentLengthHeaderValue / forbidden-header rules) will surface as undici tightens validation in future releases.
The proposed fix in #3549 (drop the manual header, let undici compute it from body) is correct regardless of undici version: spec-wise Content-Length is meant to be computed by the implementation. The fix is forward-compatible.
What does NOT change:
- The root cause (manual
Content-Lengthheader inuploadFileToS3). - The fix (1-line removal).