Skip to content

feat(server): max batch size - #7191

Merged
Nick-Lucas merged 5 commits into
mainfrom
max-batch-size
Mar 23, 2026
Merged

Nick-Lucas merged 5 commits into
mainfrom
max-batch-size

Conversation

@Nick-Lucas

@Nick-Lucas Nick-Lucas commented Feb 28, 2026 •

Copy link
Copy Markdown
Contributor

Closes #7153

🎯 Changes

Adds maxBatchSize to server adapters, validating at the earliest point possible during batch deserialisation

βœ… Checklist

  • I have followed the steps listed in the Contributing guide.
  • If necessary, I have added documentation related to the changes made.
  • I have added or updated the tests related to the changes made.

Summary by CodeRabbit

  • New Features

    • Added a server-side maxBatchSize option to enforce a maximum number of items per batch; requests that exceed it return 400 Bad Request with a clear error message.
  • Documentation

    • Added client/server guidance for limiting and auto-splitting batch requests and removed an older batch-limiting doc section.
  • Tests

    • Updated tests to verify success at the configured limit and failure with a 400 error and specific message when exceeded.

Copilot AI review requested due to automatic review settings February 28, 2026 15:57
@Nick-Lucas
Nick-Lucas requested review from a team as code owners February 28, 2026 15:57
@railway-app
railway-app Bot temporarily deployed to trpc-sse-and-websockets / trpc-pr-7191 February 28, 2026 15:57 Destroyed
@railway-app

railway-app Bot commented Feb 28, 2026 •

Copy link
Copy Markdown

πŸš… Deployed to the trpc-pr-7191 environment in trpc-sse-and-websockets

Service Status Web Updated (UTC)
next-sse-chat βœ… Success (View Logs) Web Mar 23, 2026 at 11:38 am
next-prisma-websockets-starter βœ… Success (View Logs) Mar 23, 2026 at 11:36 am

@coderabbitai

coderabbitai Bot commented Feb 28, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▢️ Resume reviews
  • πŸ” Trigger review

No actionable comments were generated in the recent review. πŸŽ‰

ℹ️ Recent review info
βš™οΈ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ecbc5c1c-059c-48e6-9bd7-b04dd8f6c9b5

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 7aca182 and da54852.

πŸ“’ Files selected for processing (3)
  • packages/server/src/unstable-core-do-not-import/http/contentType.ts
  • packages/server/src/unstable-core-do-not-import/http/resolveResponse.ts
  • www/docs/client/links/httpBatchLink.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/server/src/unstable-core-do-not-import/http/contentType.ts
  • www/docs/client/links/httpBatchLink.md

Walkthrough

Adds a server-side maxBatchSize option propagated into request parsing; JSON batch requests with more operations than the configured limit are rejected early with a 400 BAD_REQUEST and message "Batch call exceeds maximum size".

Changes

Cohort / File(s) Summary
Types
packages/server/src/unstable-core-do-not-import/http/types.ts, packages/server/src/unstable-core-do-not-import/http/contentType.ts
Added optional maxBatchSize?: number to BaseHandlerOptions and GetRequestInfoOptions.
Request parsing / enforcement
packages/server/src/unstable-core-do-not-import/http/contentType.ts
jsonContentTypeHandler.parse reads opts.maxBatchSize; when batch=1 and parsed paths length exceeds maxBatchSize, throws TRPCError with code: 'BAD_REQUEST' and message "Batch call exceeds maximum size".
Handler plumbing
packages/server/src/unstable-core-do-not-import/http/resolveResponse.ts
Forwards opts.maxBatchSize into getRequestInfo so parsing/enforcement receives configured limit.
Tests
packages/tests/server/adapters/standalone.test.ts
Replaced context-based batch-limit enforcement with maxBatchSize server option; added tests asserting success at the limit and 400 BAD_REQUEST + specific error message when exceeded.
Docs
www/docs/server/context.md, www/docs/client/links/httpBatchLink.md
Removed old context-based "Limiting Batch Size" docs; added guidance and examples for server maxBatchSize and client maxItems (auto-splitting).

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant HTTP_Handler as "HTTP Handler\n(fetchRequestHandler)"
  participant Parser as "getRequestInfo / jsonContentTypeHandler"
  participant Router

  Client->>HTTP_Handler: POST/GET ?batch=1 with N operations
  HTTP_Handler->>Parser: parse request (includes opts.maxBatchSize)
  alt N > maxBatchSize
    Parser-->>HTTP_Handler: 400 BAD_REQUEST ("Batch call exceeds maximum size")
    HTTP_Handler-->>Client: 400 Bad Request
  else N ≀ maxBatchSize
    Parser->>Router: resolve procedures (info.calls)
    Router-->>HTTP_Handler: responses
    HTTP_Handler-->>Client: 200 OK with batch results
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • #7153 β€” Adds server-side pre-parse batch-size enforcement to short-circuit oversized batches and avoid createContext bypass / DoS risk.
  • trpc/trpc#6777 β€” Implements server-side max-batch-size enforcement and returns 400 for oversized batches.

Possibly related PRs

  • trpc/trpc#7241 β€” Touches the same JSON parsing flow (jsonContentTypeHandler.parse) and header/resolve handling; likely closely related.

Suggested labels

♻️ autoupdate

Suggested reviewers

  • KATT
  • trpc-bot

Poem

πŸ‡ I count the hops in every call,
Little batches spring, large ones fall.
A steady 400 wakes the guard,
Keeps noisy queues from getting hard.
Hop safe β€” keep payloads small.

πŸš₯ Pre-merge checks | βœ… 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description identifies the closed issue and describes the main change, but the contributor checklist items remain unchecked, indicating potentially incomplete documentation and test updates. Verify that all checklist items are completed: confirm the Contributing guide was followed, documentation for maxBatchSize was added, and tests were added/updated.
βœ… Passed checks (3 passed)
Check name Status Explanation
Title check βœ… Passed The title 'feat(server): max batch size' directly and clearly summarizes the main feature addition of implementing batch size limiting on the server.
Linked Issues check βœ… Passed The code changes implement batch-size validation at the HTTP content-type parsing layer, short-circuiting before procedure resolution with BAD_REQUEST errors, and include updated tests demonstrating the enforcement.
Out of Scope Changes check βœ… Passed Changes are scoped to batch-size enforcement and documentation updates; removal of context-based batch limiting is a direct consequence of the new maxBatchSize feature and is not extraneous.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
πŸ“ Generate docstrings
  • Create stacked PR
  • Commit on current branch
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch max-batch-size

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/tests/server/adapters/standalone.test.ts (1)

283-283: Remove redundant shadowed variable.

This line creates a local t that shadows the module-level t defined at line 14. Both are identical (initTRPC.create()), so this declaration is unnecessary and could cause confusion.

♻️ Suggested fix
 test('recipe: max batch size on the server', async () => {
   const MAX_BATCH_SIZE = 10;

-  const t = initTRPC.create();
-
   const appRouter = t.router({
πŸ€– Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/tests/server/adapters/standalone.test.ts` at line 283, The test
declares a redundant local variable `const t = initTRPC.create();` that shadows
the module-level `t` (also created via `initTRPC.create()`); remove the local
declaration so the test uses the existing module-level `t` (ensure any
references in the test continue to use `t` without re-declaring it).
πŸ€– Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/tests/server/adapters/standalone.test.ts`:
- Line 283: The test declares a redundant local variable `const t =
initTRPC.create();` that shadows the module-level `t` (also created via
`initTRPC.create()`); remove the local declaration so the test uses the existing
module-level `t` (ensure any references in the test continue to use `t` without
re-declaring it).

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 6c03ce4 and 45a11ed.

πŸ“’ Files selected for processing (5)
  • packages/server/src/unstable-core-do-not-import/http/contentType.ts
  • packages/server/src/unstable-core-do-not-import/http/resolveResponse.ts
  • packages/server/src/unstable-core-do-not-import/http/types.ts
  • packages/tests/server/adapters/standalone.test.ts
  • www/docs/server/context.md
πŸ’€ Files with no reviewable changes (1)
  • www/docs/server/context.md

@Nick-Lucas Nick-Lucas changed the title max batch size feat(server): max batch size Feb 28, 2026
@pkg-pr-new

pkg-pr-new Bot commented Feb 28, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@trpc/client

npm i https://pkg.pr.new/@trpc/client@7191

@trpc/next

npm i https://pkg.pr.new/@trpc/next@7191

@trpc/openapi

npm i https://pkg.pr.new/@trpc/openapi@7191

@trpc/react-query

npm i https://pkg.pr.new/@trpc/react-query@7191

@trpc/server

npm i https://pkg.pr.new/@trpc/server@7191

@trpc/tanstack-react-query

npm i https://pkg.pr.new/@trpc/tanstack-react-query@7191

@trpc/upgrade

npm i https://pkg.pr.new/@trpc/upgrade@7191

commit: da54852

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a first-class server-side maxBatchSize option to tRPC HTTP handlers/adapters to reject oversized batch calls early (during request info parsing), addressing a DoS/bypass vector where createContext-based limits can be skipped.

Changes:

  • Introduces maxBatchSize on server HTTP handler options (BaseHandlerOptions) and wires it into request parsing.
  • Enforces the limit in the JSON content-type request parser before input deserialization.
  • Updates the standalone adapter test to use the new maxBatchSize option and adjusts expected error details; removes the old docs recipe snippet.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
www/docs/server/context.md Removes the prior β€œlimit batch size via context” recipe (currently without replacement docs for maxBatchSize).
packages/tests/server/adapters/standalone.test.ts Updates the batch-size β€œrecipe” test to configure maxBatchSize on the server and assert the new error behavior.
packages/server/src/unstable-core-do-not-import/http/types.ts Adds maxBatchSize?: number to base handler options with JSDoc guidance.
packages/server/src/unstable-core-do-not-import/http/resolveResponse.ts Plumbs maxBatchSize through to getRequestInfo.
packages/server/src/unstable-core-do-not-import/http/contentType.ts Enforces maxBatchSize during JSON request parsing (before reading/parsing the body).

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread www/docs/server/context.md Resolved
@railway-app
railway-app Bot temporarily deployed to trpc-sse-and-websockets / trpc-pr-7191 February 28, 2026 16:09 Destroyed
@vercel

vercel Bot commented Feb 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
next-prisma-starter Ready Ready Preview Mar 23, 2026 11:30am
og-image Ready Ready Preview, Comment Mar 23, 2026 11:30am

Request Review

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
www/docs/client/links/httpBatchLink.md (1)

105-105: Consider using American English spelling for consistency.

The word "organisations" uses British spelling. Most open-source projects and technical documentation use American English ("organizations") for consistency.

πŸ“ Suggested spelling change
-Some organisations are concerned that request batching may increase the service impact of abuse such as DDoS attacks. While this is typically best addressed with proper rate limiting and WAF policies, you can also cap the number of operations allowed in a batch if desired.
+Some organizations are concerned that request batching may increase the service impact of abuse such as DDoS attacks. While this is typically best addressed with proper rate limiting and WAF policies, you can also cap the number of operations allowed in a batch if desired.
πŸ€– Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@www/docs/client/links/httpBatchLink.md` at line 105, Update the British
spelling "organisations" to American English "organizations" in the sentence
starting "Some organisations are concerned..." (and search the same document for
any other occurrences of "organisations"/"organisation" to change to
"organizations"/"organization"); keep the rest of the sentence unchanged and
ensure consistency across the markdown file.
πŸ€– Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@www/docs/client/links/httpBatchLink.md`:
- Line 105: Update the British spelling "organisations" to American English
"organizations" in the sentence starting "Some organisations are concerned..."
(and search the same document for any other occurrences of
"organisations"/"organisation" to change to "organizations"/"organization");
keep the rest of the sentence unchanged and ensure consistency across the
markdown file.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 45a11ed and 564d3e7.

πŸ“’ Files selected for processing (1)
  • www/docs/client/links/httpBatchLink.md

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
packages/tests/server/adapters/standalone.test.ts (2)

316-331: Test logic is correct but assertion pattern is unconventional.

The test correctly validates that exactly MAX_BATCH_SIZE requests succeed. However, nesting expect() inside .every() is unusual - if the inner expect fails, it throws before .every() completes. Consider using .forEach() for assertions and .every() only for filtering:

♻️ Alternative assertion pattern
-  expect(
-    results1.every((res) => {
-      if (res.status !== 'fulfilled') {
-        return false;
-      }
-
-      expect(res.value).toBe('hello test');
-
-      return true;
-    }),
-  ).toBe(true);
+  expect(results1.every((res) => res.status === 'fulfilled')).toBe(true);
+  for (const res of results1) {
+    if (res.status === 'fulfilled') {
+      expect(res.value).toBe('hello test');
+    }
+  }
πŸ€– Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/tests/server/adapters/standalone.test.ts` around lines 316 - 331,
The current test uses expect() inside results1.every(), which can throw during
iteration; change the assertion pattern: first assert that results1.length ===
MAX_BATCH_SIZE and that results1.every(r => r.status === 'fulfilled') (using
results1 and MAX_BATCH_SIZE), then iterate over results1 with a forEach to call
expect(res.value).toBe('hello test') for each fulfilled result (referring to
promises1, results1, and client.hello.query) so assertions run directly and
failures report clearly.

283-283: Variable shadowing is intentional but consider removing redundant declaration.

The t variable at line 283 shadows the module-level t declared at line 14. Both are created identically via initTRPC.create(). Since this test doesn't need different tRPC configuration, consider reusing the module-level t for consistency.

♻️ Proposed simplification
 test('recipe: max batch size on the server', async () => {
   const MAX_BATCH_SIZE = 10;

-  const t = initTRPC.create();
-
   const appRouter = t.router({
πŸ€– Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/tests/server/adapters/standalone.test.ts` at line 283, The local
test-level declaration "const t = initTRPC.create();" shadows the module-level
"t" (both created identically); remove the local declaration and reuse the
existing module-level variable "t" throughout the test to avoid redundancy and
shadowing (update any references in the test to use the module-level "t" and
delete the duplicated initialization).
πŸ€– Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/tests/server/adapters/standalone.test.ts`:
- Around line 316-331: The current test uses expect() inside results1.every(),
which can throw during iteration; change the assertion pattern: first assert
that results1.length === MAX_BATCH_SIZE and that results1.every(r => r.status
=== 'fulfilled') (using results1 and MAX_BATCH_SIZE), then iterate over results1
with a forEach to call expect(res.value).toBe('hello test') for each fulfilled
result (referring to promises1, results1, and client.hello.query) so assertions
run directly and failures report clearly.
- Line 283: The local test-level declaration "const t = initTRPC.create();"
shadows the module-level "t" (both created identically); remove the local
declaration and reuse the existing module-level variable "t" throughout the test
to avoid redundancy and shadowing (update any references in the test to use the
module-level "t" and delete the duplicated initialization).

ℹ️ Review info
βš™οΈ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 13f8541c-823f-42f2-9c06-23c86c3216a6

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between f086a04 and 7aca182.

πŸ“’ Files selected for processing (6)
  • packages/server/src/unstable-core-do-not-import/http/contentType.ts
  • packages/server/src/unstable-core-do-not-import/http/resolveResponse.ts
  • packages/server/src/unstable-core-do-not-import/http/types.ts
  • packages/tests/server/adapters/standalone.test.ts
  • www/docs/client/links/httpBatchLink.md
  • www/docs/server/context.md
πŸ’€ Files with no reviewable changes (1)
  • www/docs/server/context.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/server/src/unstable-core-do-not-import/http/contentType.ts
  • www/docs/client/links/httpBatchLink.md
  • packages/server/src/unstable-core-do-not-import/http/resolveResponse.ts

@themavik themavik left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maxBatchSize runs on comma-split paths inside jsonContentTypeHandler.parse, which matches httpBatchLink batch URLs. Custom adapters that batch without that shape will not hit this guardβ€”fine, just know the limit is tied to that parser.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.


πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 87 to +96
const paths = isBatchCall ? opts.path.split(',') : [opts.path];
if (
isBatchCall &&
typeof maxBatchSize === 'number' &&
paths.length > maxBatchSize
) {
throw new TRPCError({
code: 'BAD_REQUEST',
message: `Batch call exceeds maximum size`,
});

Copilot AI Mar 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opts.path.split(',') allocates an array with one entry per comma before the size check. With a long path containing many commas, this can create a large allocation even when maxBatchSize is small. Consider counting segments up to maxBatchSize + 1 (e.g., scan the string for commas and early-exit) and only performing a full split when within the limit.

Suggested change
const paths = isBatchCall ? opts.path.split(',') : [opts.path];
if (
isBatchCall &&
typeof maxBatchSize === 'number' &&
paths.length > maxBatchSize
) {
throw new TRPCError({
code: 'BAD_REQUEST',
message: `Batch call exceeds maximum size`,
});
let paths: string[];
if (isBatchCall) {
if (typeof maxBatchSize === 'number') {
// Count segments up to maxBatchSize + 1 without allocating an array.
let segments = 1;
const path = opts.path;
for (let i = 0; i < path.length && segments <= maxBatchSize; i++) {
if (path[i] === ',') {
segments++;
}
}
if (segments > maxBatchSize) {
throw new TRPCError({
code: 'BAD_REQUEST',
message: `Batch call exceeds maximum size`,
});
}
}
paths = opts.path.split(',');
} else {
paths = [opts.path];

Copilot uses AI. Check for mistakes.
const paths = isBatchCall ? opts.path.split(',') : [opts.path];
if (
isBatchCall &&
typeof maxBatchSize === 'number' &&

Copilot AI Mar 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typeof maxBatchSize === 'number' will treat NaN/Infinity as valid, but the comparison can then fail to enforce the limit (e.g., paths.length > NaN is always false). Validate maxBatchSize as a finite, positive integer (e.g., Number.isSafeInteger(maxBatchSize) && maxBatchSize > 0) or explicitly document/handle these edge values.

Suggested change
typeof maxBatchSize === 'number' &&
Number.isSafeInteger(maxBatchSize) &&
maxBatchSize > 0 &&

Copilot uses AI. Check for mistakes.
```ts title="server.ts"
import { createHTTPServer } from '@trpc/server/adapters/standalone';

createHTTPServer({

Copilot AI Mar 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The createHTTPServer snippet is missing required options (at least router). As written, it won’t work if copied verbatim. Consider including router: appRouter (and any other required fields) or using an ellipsis to indicate omitted options.

Suggested change
createHTTPServer({
createHTTPServer({
router: appRouter,

Copilot uses AI. Check for mistakes.
Comment on lines +151 to +152
```ts title='pages/api/trpc/[trpc].ts'
export default trpcNext.createNextApiHandler({

Copilot AI Mar 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Next.js example calls createNextApiHandler with only maxBatchSize, but the handler also requires router (and typically createContext). Consider expanding the snippet so it’s runnable when copied.

Suggested change
```ts title='pages/api/trpc/[trpc].ts'
export default trpcNext.createNextApiHandler({
```ts title='pages/api/trpc/[trpc].ts'
import * as trpcNext from '@trpc/server/adapters/next';
import { appRouter, createContext } from '../../../server';
export default trpcNext.createNextApiHandler({
router: appRouter,
createContext,

Copilot uses AI. Check for mistakes.

### 1. Set a maximum batch size on your server:

`maxBatchSize` limits how many operations may be sent in a single batch request. Requests exceeding this limit will be rejected with a `400 Bad Request` error. This can be passed to any tRPC adapter.

Copilot AI Mar 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs say maxBatchSize β€œcan be passed to any tRPC adapter”, but this option is specific to the HTTP request handlers (it won’t apply to non-HTTP adapters like WS). Consider rewording to β€œany HTTP adapter” to avoid confusion.

Suggested change
`maxBatchSize` limits how many operations may be sent in a single batch request. Requests exceeding this limit will be rejected with a `400 Bad Request` error. This can be passed to any tRPC adapter.
`maxBatchSize` limits how many operations may be sent in a single batch request. Requests exceeding this limit will be rejected with a `400 Bad Request` error. This can be passed to any HTTP adapter.

Copilot uses AI. Check for mistakes.
@Nick-Lucas
Nick-Lucas merged commit c9c211f into main Mar 23, 2026
49 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 24, 2026
@KATT
KATT deleted the max-batch-size branch October 31, 2026 21:11

This branch was successfully deployed

5 active deployments
Preview – www β€” da548524 Deployed Mar 23, 2026 by vercel[bot]
Preview – trpc-next-app-dir β€” da548524 Deployed Mar 23, 2026 by vercel[bot]
Preview – next-prisma-starter β€” da548524 Deployed Mar 23, 2026 by vercel[bot]
Preview – examples-todomvc β€” da548524 Deployed Mar 23, 2026 by vercel[bot]
Preview – og-image β€” da548524 Deployed Mar 23, 2026 by vercel[bot]
trpc-sse-and-websockets / trpc-pr-7191 β€” da548524 Deployed Mar 23, 2026 by railway-app[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: max batch size handling bypass

4 participants