Repository navigation
fix(node): require maxBodySize in TmpFileUploadHandlerPlugin - #2543
Conversation
More templates
@orpc/ai-sdk
@orpc/arktype
@orpc/bun
@orpc/client
@orpc/cloudflare
@orpc/contract
@orpc/effect
@orpc/evlog
@orpc/hibernation
@orpc/json-schema
@orpc/experimental-lock
@orpc/mcp
@orpc/msw
@orpc/nest
@orpc/next
@orpc/node
@orpc/openapi
@orpc/experimental-openapi-inference
@orpc/opentelemetry
@orpc/pinia-colada
@orpc/pino
@orpc/publisher
@orpc/ratelimit
@orpc/server
@orpc/shared
@orpc/swr
@orpc/tanstack-query
@orpc/trpc
@orpc/valibot
@orpc/zod
commit: |
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound — the plugin is still pre-2.0 beta and the unbounded default was the disk-fill vector, so requiring maxBodySize turns "unlimited" into a deliberate Number.POSITIVE_INFINITY choice that matches what the JSDoc and docs already claimed.
Reviewed changes — full diff (6 files, 1 commit), plus repo-wide call-site and docs checks:
- Required option, no fallback —
maxBodySizeloses| undefinedand the constructor loses its= {}default;this.maxBodySize = options.maxBodySizereplaces thePOSITIVE_INFINITYdefault. The resolver-function form is untouched. - Type-level regression test — the new
tmp-file-upload-handler-plugin.test-d.tsasserts the no-arg, empty-object, and missing-kind cases all fail to compile, and that fixed and async limits compile. I confirmed the file is actually typechecked: injecting an unused@ts-expect-errormakespnpm checkfail with TS2578, so the assertions are not a silent no-op. - Tests — every construction site uses explicit limits now (
UNLIMITEDin the unit suite, the pre-existingUNLIMITEDin the e2e suite), preserving prior coverage. Repo-wide grep found no missed call sites in other packages, playgrounds, or docs. - Docs — the setup example, the "Limiting Body Sizes" wording, the "subsumes the request limit plugin" sentence, and the blog sentence are all consistent with the new contract; no remaining claim that the option is optional.
Verified locally: pnpm check clean (1155 files), the two @orpc/node suites pass (61 tests), pnpm docs:validate clean, and oxfmt --check clean on all six files.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
orpc | b8c055f | Commit Preview URL Branch Preview URL |
Nov 23 2026, 10:04 AM |

What
TmpFileUploadHandlerPluginnow requiresmaxBodySize, withmemory,fileandstreamall required inside it. The constructor's options argument is therefore required too. The resolver-function form is unchanged.Why
The plugin spools multipart and file bodies to
os.tmpdir()before input validation. With no options it defaulted every limit toInfinity, so a single request could fill the disk. Its JSDoc and docs already said all three kinds are required "so none is left unbounded by accident", andRequestLimitHandlerPlugin, which this plugin subsumes, already requires itsmaxBodySize. Making it required after 2.0 would be a breaking change.Breaking
new TmpFileUploadHandlerPlugin()and options withoutmaxBodySizeno longer compile. To keep the old behaviour, passNumber.POSITIVE_INFINITYfor each kind.Changes
packages/node: required option, unlimited default removed, new*.test-d.tsasserting the type errors, tests updated to pass explicit limits.plugins/tmp-file-upload.mdxnow shows limits, and the wording says the option is required. One sentence in the uploads blog post is corrected to match.Not included
Temp directories named
orpc-upload-*orphaned by a crash are still not swept. A sweep needs an age threshold and has to be safe when several processes share onetmpDir, so it is left for a separate decision.