147 questions
Best practices
0
votes
2
replies
23
views
How to handle initial/default state when using tRPC RouterOutputs as the source of truth for TypeScript types?
I’m using tRPC in an Expo (React Native) app and deriving frontend types directly from the generated API output.
import type { RouterOutputs } from "../utils/trpc";
type UserDetails = ...
1
vote
0
answers
55
views
tRPC errorFormatter not inferring types to the frontend
My project is in 2 parts
The Backend : Fastify + trpc/server
The Frontend : NextJS.
This isn't a monorepo project, rather exists in 2 separate repos
On the backend, I generate the trpc AppRouter ...
0
votes
0
answers
102
views
TRPC prefetching fails on protected procedure
I was working on a nextjs monorepo using trpc as backend I am integrating SSE with normal trpc methods, I implemented auth using better auth and it works very smoothly, but when I try to prefetch on ...
0
votes
1
answer
72
views
Hono tRPC-server body issue
I have been trying to get Cloudflare Workers, Hono and tRPC working for tens of hours now.
I am using the @hono/trpc-server package which gives me middleware for trpc to run with hono. They even have ...
0
votes
0
answers
37
views
T3 Stack Page Routing Boilerplate does not work
I am trying to create an app using the T3 stack. I am following the instructions in the T3 documentation which start by telling us to use the command npm create t3-app@latest. After doing that, we get ...
2
votes
1
answer
199
views
How do I distinguish between query and mutation in runtime?
I'm using Typescript 5, Next.js 15, tRPC 11, React Query 5 and React 19.
How can I programmatically differentiate between DecoratedMutation<...> and DecoratedQuery<...>?
I have tried:
...
0
votes
0
answers
105
views
NextJs + tRPC with Nginx as reverse proxy - duplicate header Transfer-Encoding: chunked
tRPC when used on client side with .useMutation() hook sends duplicate Transfer-Encoding: chunked header
Link to reproduction:
https://github.com/DownDev/trpc-bug
To reproduce
run using: docker ...
1
vote
1
answer
44
views
How to "extract" the generic type from a generic arrow function?
I'm attempting to use tRPC to create a virtual backend router, in which the client uses splitLink in order to direct the HTTP request to the appropriate microservice.
I am attempting to import several ...
0
votes
0
answers
78
views
Next server actions leaking .env
I've got some router for generating pre-signed S3 URLs.
router: https://pastebin.com/zSQ4MRjK (it's not meant to be a public procedure)
I created an actions file like this:
"use server";
...
-1
votes
1
answer
236
views
turn-off error obfuscation in production for server actions on Vercel
Locally everything is fine, when deployed to Vercel, backend runtime errors are trapped by Vercel/Next.js and they are automatically obfuscated, which is nice, but I want to turn it off.
unfortunately ...
0
votes
0
answers
94
views
"Nest could not find XXXX element (this provider does not exist in the current context)" when configuration is correct
I have a monorepo that incorporates NestJS (standalone app), NextJS (app router), tRPC and React Query (to connect the backend to the frontend)
While the configuration I'm 100% sure is correct, I'm ...
0
votes
0
answers
187
views
How are you supposed to handle loading states for trpc (useQuery) calls in client components in Next?
I have a client component that calls for data via trpc. I extract isLoading from those useQuery calls and then I want to display a loading skeleton while the data is loading.
However, when I follow ...
-1
votes
1
answer
155
views
Why doesn't invalidateQueries accept the full query key from trpc.router.endpoint.queryKey()?
I'm using tRPC with React Query and trying to invalidate a specific query using the full query key generated by trpc.
Here's what I'm doing:
const likeFullKey = trpc.like.getLikesByUser.queryKey();
...
0
votes
0
answers
183
views
Troubleshooting createTRPCOptionsProxy with Server Components and Context Passing
How does createTRPCOptionsProxy work in server components?
I'm creating a context that passes the hono context to createTRPCContext in order to obtain the HTTP headers, since I need to forward those ...
0
votes
0
answers
222
views
Integrating Hono.js with tRPC in Next.js: Routing and Context Considerations
I want to combine Hono.js with tRPC. I followed the guide on the 3rd party middleware made by hono for a tRPC server, and now I have set up the hono tRPC server 3rd party middleware similar to the ...