Use this tag for tRPC, the TypeScript library for defining and using type-safe APIs for use with TypeScript servers and clients. For Remote Procedure Call, use [rpc] instead.
Questions tagged [trpc.io]
124 questions
1
vote
1 answer
How to setup tRPC project with pnpm
I am trying to learn from this repo.
Step 3 of the setup instructions says to run yarn dx.
The package.json for this repo defines that script as:
"dx": "run-p dx:* --print-label",
When I try to do this, I get an error message that says:
yarn dx…

Mel
- 2,481
- 26
- 113
- 273
1
vote
0 answers
TRPC v10 how to achieve pathnames with dash in routes
In TRPCv9 the way we defined routes was something like this
const appRouter = trpc.router()
.query('greeting', {
input: z.string(),
resolve({ input }) {
return `hello ${input}!`;
},
});
Now in TRPCv10, as stated in the…

netlemon
- 964
- 8
- 22
1
vote
2 answers
Obtaining typescript type of trpc or react-query's useQuery result "data" property
In my React + TRPC application, I call const { data: promotion } = trpc.promotions.getPromotion.useQuery({ id: promotionId }) in the client-side. promotion's type is detected by looking at the return type of the actual server-side code:
…

helion3
- 34,737
- 15
- 57
- 100
1
vote
1 answer
Signin method with Nextjs and trpc returning resolver is not a function
So im trying to build my register method without re-enventing nothing crazy with the create-t3-app stack with nextjs, trpc and nextauth:
export const signUpRouter = router({
signup: publicProcedure.input(UserModel).mutation(async ({ ctx, input })…

RicardoFonseca
- 31
- 1
1
vote
0 answers
Expo + trpc: Uncaught Error: No QueryClient set, use QueryClientProvider to set one
I have an issue with expo and trpc. I'm trying to spin up this stack for my application and have fully working type-checking. And so far it is working on iOS simulator but not on the web.
So is my app.tsx
export default function App() {
return (
…

dezerb
- 138
- 2
- 12
1
vote
0 answers
tRPC without SSR
When using tRPC with ssr it uses getInitialProps, which has kinda of a cool effect in terms how a page is rendered, since it's rendered server-side on initial requests and client-side on route transitions.
Unfortunately, enabling ssr means that you…

nehalist
- 1,434
- 18
- 45
1
vote
1 answer
Using tRPC for dynamic routes in NextJs
So I just started a small project using the full t3 stack (Nextjs, prisma, tailwind, tRPC), and have run into a small issue.
To give a little backstory, I have a database with artists (name, email, address, id, url) related to a "art" table…

Louis Stephens
- 53
- 8
1
vote
2 answers
How would I update React state after a successful tRPCv10 call?
I'm trying to get a handle on the new tRPC version 10 with a basic shopping list CRUD Nextjs app. I have successfully set up the tRPC endpoint with "get all" and a "create" handlers and can confirm that they both work after testing from the front…

Caelan Curry
- 13
- 4
1
vote
1 answer
How can I pass locale (i18n) to tRPC?
as the title refers, is there a way to pass locale to tRPC context (other than passing it as an input from useRouter hook)?
Couldn't find any information related to i18n in the docs.
Thanks.
// src/server/router/context.ts
import * as trpc from…

Kene
- 85
- 1
- 3
- 7
1
vote
3 answers
trpc v10 - Error: Query data cannot be undefined
New to trpc. Trying to get basic query functionality but it's not working. Not sure what I'm missing. In v9 it used createReactQueryHooks(), but it seems in v10 you only need to use createTRPCNext() if I'm not mistaken inside…

wongz
- 3,255
- 2
- 28
- 55
1
vote
2 answers
ExcelJs download xlsx file with tRPC router
I want to click the bottom and download the excel file, but I can't figure out why it is not working. the main problem is at tRPC router side.
the tool I using:
T3
ExcelJs
tRPC router:
.mutation("xlsx", {
input: z.object({
id:…

Balius
- 39
- 11
1
vote
0 answers
How to view all logs with tRPC + Serverless Stack
We recently implemented a backend API that leverages tRPC v10 and Serverless Stack. It has been working great, but I just noticed that supplemental logs do not appear in CloudWatch (AWS) after we deploy.
As you can see in the image below, we have a…

ProgrammingPatron
- 33
- 1
- 5
1
vote
1 answer
Next.js / tRPC with WebSockets
I am building an app with Next.JS and tRPC. As I need real-time communication inside my app, I want to use Websockets, which are nicely integrated into rRPC as subscriptions. (See https://trpc.io/docs/subscriptions)
In the documentation of tRPC they…

Lukas Thiersch
- 155
- 2
- 15
1
vote
0 answers
tRCP is fetching data again, even when it's fetched and provided in getServerSideProps
In my project I'm using NextJs and tRPC for backend calls. I wanted to fetch some data in getServerSideProps using tRPC and provide it in Page component, also using react-query state for whole application. Here's my _app withTRPC config
export…

Zenek Wiaderko
- 392
- 2
- 14
1
vote
1 answer
How to use trpc query if input data is not available at mount?
I have a component with a list of conversations and i want to load a specific conversation on click. The problem is that I have to initialise the second trpc query at mount and I dont have the required data yet. Any help would be highly apriciated.

Kuba Kaczmarek
- 65
- 6