Skip to content

Conversation

@theoludwig
Copy link
Contributor

@theoludwig theoludwig commented Aug 22, 2025

Since Fastify v5.5.0, there is the following deprecation warning:

[FSTDPE022] FastifyWarning: The router options for maxParamLength property access is deprecated. Please use "options.routerOptions" instead for acce
ssing router options. The router options will be removed in fastify@6.

Related fastify/fastify#6282, fastify/fastify#5985

🎯 Changes

Update the Fastify adapter documentation to fix the deprecation warning.

Should we put the 2 possible ways for both v5.4 and prior Fastify versions, and for v5.5.0 and above, or it's fine to only put the "latest" way (like how it is done currently in this PR)?

✅ 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

  • Documentation
    • Updated Fastify adapter docs to show maxParamLength is now configured under routerOptions (default 5000).
    • Clarified that server initialization and plugin setup are unchanged.
    • Confirmed no changes to public APIs and guided users to configure maximum URL parameter lengths in the new location.

@vercel
Copy link

vercel bot commented Aug 22, 2025

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

Project Deployment Preview Comments Updated (UTC)
www Ready Ready Preview Comment Oct 25, 2025 5:15pm

@vercel
Copy link

vercel bot commented Aug 22, 2025

@theoludwig is attempting to deploy a commit to the trpc Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 22, 2025

Walkthrough

The Fastify adapter docs were updated to move maxParamLength from top-level Fastify options into a nested routerOptions object, preserving the value (5000). No other examples, logic, or error handling were changed.

Changes

Cohort / File(s) Change Summary
Docs: Fastify adapter configuration
www/docs/server/adapters/fastify.md
Moved maxParamLength from top-level Fastify options into routerOptions in the configuration example; value remains 5000. No changes to exports or public APIs.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A nibble of docs, a hop to the nest,
maxParamLength burrows where routers rest.
Same crunchy number, new cozy spot—
I twitch my whiskers, “Consistency caught!” 🐇
Paths stay long, configs stay neat.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description includes the rationale, change summary under “## 🎯 Changes,” and a completed checklist, but it omits the required “Closes #” line at the top of the template indicating the issue or PR being closed. Add a “Closes #6906” or the appropriate issue/PR number at the top of the description to fully comply with the repository’s template requirements.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Title Check ✅ Passed The title clearly and concisely describes the primary change of updating the Fastify adapter documentation to use routerOptions and matches the conventional “docs(...)” prefix style without superfluous details or noise.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Aug 22, 2025

Open in StackBlitz

@trpc/client

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

@trpc/next

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

@trpc/react-query

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

@trpc/server

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

@trpc/tanstack-react-query

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

@trpc/upgrade

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

commit: 1951bb9

@theoludwig
Copy link
Contributor Author

Set as draft because TypeScript types have not yet been updated.
Ref: fastify/fastify#6282 (comment)

@KATT KATT added the ⏳ close if no activity Will be closed if no activity happens within a few weeks label Sep 5, 2025
@theoludwig theoludwig marked this pull request as ready for review September 8, 2025 06:33
@theoludwig theoludwig requested a review from a team as a code owner September 8, 2025 06:33
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
www/docs/server/adapters/fastify.md (2)

120-126: Reword to explicitly reference routerOptions and Fastify version

Tiny clarity tweak so the prose aligns with the snippet and deprecation context.

Apply:

- tRPC includes an adapter for [Fastify](https://www.fastify.io/) out of the box. This adapter lets you convert your tRPC router into a [Fastify plugin](https://www.fastify.io/docs/latest/Reference/Plugins/). In order to prevent errors during large batch requests, make sure to set the `maxParamLength` Fastify option to a suitable value, as shown.
+ tRPC includes an adapter for [Fastify](https://www.fastify.io/) out of the box. This adapter lets you convert your tRPC router into a [Fastify plugin](https://www.fastify.io/docs/latest/Reference/Plugins/). To prevent errors during large batch requests, set `routerOptions.maxParamLength` (Fastify ≥5.5) to a suitable value, as shown below.

163-165: Add a short compatibility note for Fastify <5.5

Given the ongoing transition and the PR description, consider a small “Compatibility” block with the legacy snippet to help users on older Fastify versions. Keeps the main path modern while reducing friction.

Append right after the code block:

+:::note Compatibility (Fastify <5.5)
+If you're on an older Fastify version (<5.5), configure `maxParamLength` at the top level:
+
+```ts title='server.ts (Fastify <5.5)'
+const server = fastify({
+  maxParamLength: 5000,
+});
+```
+Router options moved under `routerOptions` in Fastify 5.5 and will be removed from the top level in Fastify 6.
+:::
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e6fc309 and 756de3b.

📒 Files selected for processing (1)
  • www/docs/server/adapters/fastify.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,md,mdx}

📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

Use camelCase for file names (with exceptions like TRPC/RPC/HTTP/JSON acronyms, .config.js, .d.ts, and tests)

Files:

  • www/docs/server/adapters/fastify.md
🧠 Learnings (1)
📚 Learning: 2025-09-05T15:16:01.751Z
Learnt from: CR
PR: trpc/trpc#0
File: .cursor/rules/react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:01.751Z
Learning: Applies to packages/react-query/**/*.test.tsx : Create the tRPC React client with createTRPCReact<typeof appRouter>()

Applied to files:

  • www/docs/server/adapters/fastify.md
🔇 Additional comments (2)
www/docs/server/adapters/fastify.md (2)

138-141: LGTM: updated to routerOptions for Fastify ≥5.5

This matches the deprecation in Fastify 5.5 and future removal in v6. No issues with the snippet as shown.


128-153: Confirm TS types across Fastify versions

Doc snippet compiles in newer setups, but users on older Fastify types may not have routerOptions typed. Since this PR is docs-only, a brief version callout (as above) should suffice. If/when types in @types/fastify or Fastify core are updated, consider linking their minimum version here.

Would you like me to open a follow-up to add a pinned “Works with Fastify ≥5.5” note and link the Fastify PRs you referenced in the PR description?

@theoludwig
Copy link
Contributor Author

@KATT Ready to be merged. 😄

@KATT KATT enabled auto-merge (squash) October 14, 2025 22:32
@KATT KATT merged commit 5ad18f6 into trpc:main Oct 25, 2025
44 of 47 checks passed
@theoludwig theoludwig deleted the docs/fastify-adapter-router-options branch October 25, 2025 17:55
@github-actions
Copy link
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 Oct 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

♻️ autoupdate ⏳ close if no activity Will be closed if no activity happens within a few weeks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants