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 = ...
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 ...
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
191
views
Why aren't my next.js cookies storing on mobile, when it works just fine on desktop?
I've inherited working on a next.js app and have run into a quite frustrating scenario. After logging into the app, the session (iron-session) is stored in a cookie for authentication/session ...
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
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
1
answer
292
views
Next build can't resolve monorepo aliases. It's killing me
I am building a simple nextjs frontend with an express backend. I can run them both together in dev mode perfectly. But when I try to 'next build' the front package, there seem to be problems that I ...
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 ...
2
votes
0
answers
509
views
How do I add a global error handler that can translate errors into different TRPCErrors?
In my TRPC app, I have a service that we use that does something like this:
export class MyCustomService {
public myCustomMethod() {
throw new MyCustomError('I am a custom error message!')
}
}
...
-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
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";
...
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 ...