-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
docs(adapters/fastify): usage of routerOptions #6906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(adapters/fastify): usage of routerOptions #6906
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@theoludwig is attempting to deploy a commit to the trpc Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe Fastify adapter docs were updated to move Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
@trpc/client
@trpc/next
@trpc/react-query
@trpc/server
@trpc/tanstack-react-query
@trpc/upgrade
commit: |
|
Set as draft because TypeScript types have not yet been updated. |
There was a problem hiding this 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 versionTiny 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.5Given 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
📒 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.5This 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 versionsDoc snippet compiles in newer setups, but users on older Fastify types may not have
routerOptionstyped. 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?
756de3b to
62c2a36
Compare
|
@KATT Ready to be merged. 😄 |
|
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. |
Since Fastify v5.5.0, there is the following deprecation warning:
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
Summary by CodeRabbit