You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs: Disable error redaction on dehydration when using Next.js #6771
In the new tRPC integration with React Query, there is no mention of disabling error redaction in Server Components when using Next.js. It could be helpful to include a small info card stating that if you are using Next.js, you should add something along the lines of the following:
newQueryClient({defaultOptions: {
...
dehydrate: {
...
shouldRedactErrors: (error)=>{// We should not catch Next.js server errors// as that's how Next.js detects dynamic pages// so we cannot redact them.// Next.js also automatically redacts errors for us// with better digests.
return false;},},},});
🤖 In v12, createTrpcRsc from @trpc12/tanstack-react-query/rsc handles this by default: when it dehydrates a pending query that later fails, it redacts the error unless the error has a digest, so Next still sees the errors it uses to detect dynamic rendering, and the build no longer fails with a redacted error. Setting dehydrate.shouldRedactErrors on your query client still overrides it. https://v12.trpc.io/v12/docs/integrations/rsc. v12 isn't released yet and there's no ETA.
I’d like to pick this up for v11: a short note in the App Router setup and Server Components pages showing dehydrate.shouldRedactErrors so Next.js errors with a digest aren’t redacted. OK to go ahead?
This issue has been locked because we are very unlikely to see comments on closed issues. If you are running into a similar issue, please create a new issue. Thank you.
Activity
jianwei0510 commentedon May 22, 2025
You really save my day because I've tried to figure this error for two days when using
pnpm build.Besides I used same way integrating with tRPC with two of my projects:
"next": "15.1.0"and"@tanstack/react-query": "^5.74.4"<-- work fine and don't encounter this error ✅"next": "15.2.2"and"@tanstack/react-query": "^5.74.3"<-- Error: redacted ❎So I think this error may only happen in 15.2 or higher version next.js when ingrating with tRPC.
fix: Next's redirect(), notFound() and dynamic-API errors pass throug…
KATT commentedon Nov 2, 2026
🤖 In v12,
createTrpcRscfrom@trpc12/tanstack-react-query/rschandles this by default: when it dehydrates a pending query that later fails, it redacts the error unless the error has adigest, so Next still sees the errors it uses to detect dynamic rendering, and the build no longer fails with a redacted error. Settingdehydrate.shouldRedactErrorson your query client still overrides it. https://v12.trpc.io/v12/docs/integrations/rsc. v12 isn't released yet and there's no ETA.hasanmahira commentedon Nov 3, 2026
I’d like to pick this up for v11: a short note in the App Router setup and Server Components pages showing dehydrate.shouldRedactErrors so Next.js errors with a digest aren’t redacted. OK to go ahead?
docs(www): document dehydrate.shouldRedactErrors for Next.js builds (t…
github-actions commentedon Nov 11, 2026
This issue has been locked because we are very unlikely to see comments on closed issues. If you are running into a similar issue, please create a new issue. Thank you.