Questions tagged [trpc]

67 questions
0
votes
1 answer

'Unhandled Runtime Error' using TRPC's useQuery

I am trying to use the [id] paramether from my [id].tsx filename inside a TRPC query, but getting the error: Unhandled Runtime Error Error: Rendered more hooks than during the previous render. This is because the 'id' paramether is unknown…
peternovak
  • 103
  • 1
  • 11
0
votes
0 answers

tRPC router introspection for testing

Background I have an API where I need to authenticate the caller after input validation. This is because for some endpoints the authorization depends on information provided in input parameters (e.g. which server side resource the caller wants to…
Lqueryvg
  • 202
  • 3
  • 9
0
votes
1 answer

TRPC optimistic updates on nested arrays

I'm developing a todo app using TRPC+Prisma+NextJS Right now, the app shows a list of todos stored in database. I'd like to optimistically update the state of the todo (finish / pending) Right now, I can apply the optimistic update creating a new…
0
votes
0 answers

TRPC ratelimiting endpoints

I am currently having some problems with a race condition in my TRPC nextJS api. Essentially what is happening is I have a enforceGuildPermissions method, which basically checks if the user who is making the request has permission to get the data…
kamza
  • 75
  • 5
0
votes
1 answer

Calling useInfiniteQuery with tRPC results in a TRPCClientError due to cursor

I was previously calling the useQuery hook with tRPC in order to fetch data without issue. However, when I transitioned over to useInfiniteQuery a TRPCClientError occurred. This has something to do with the cursor used to track pagination which was…
isoaxe
  • 177
  • 2
  • 11
0
votes
1 answer

SSGHelpers and GetStaticProps question regarding params

I am trying to use createProxySSGHelpers to prefetch data with trpc in a project I'm working on, and I'm having a hard time figuring out why I cannot get my id from url params is coming back undefined when I can see it in my url bar. Here is my…
Mossy82
  • 115
  • 1
  • 9
0
votes
1 answer

How to deploy a React and an Express app on different providers when they both use tRPC?

I have a React app and an Express app. I have configured both to use tRPC. In the client i have this file, that gets the AppRouter type from a relative path on my machine (this is the utils/trpc.ts file): import { createTRPCReact } from…
0
votes
1 answer

How to type my component props from a trpc type

I'm experimenting with a React Native + React Query and tRPC + Prisma setup and finding some problems with the typo workflow between tRPC and react I'm querying my data on one screen const { data: highline, isFetchedAfterMount } =…
Bodok
  • 336
  • 2
  • 13
0
votes
0 answers

Slack API CORS error in TRPC (works fine locally)

When I try to send the slack notification locally, it works fine, but when I tried it in production I get this typical CORS error. "Access to fetch at 'https:///trpc/orientation.create?batch=1' from origin 'https://' has been blocked by CORS policy:…
Arpit
  • 467
  • 1
  • 8
  • 18
0
votes
1 answer

serve a dynamically generated file from a serverless NextJs application

My NextJs application (t3-stack) runs on Vercel and I use a Planetscale mysql database. It contains a form to collect data and write it into the database. I want to serve the data collected in the form to my users as a csv file. Is there some…
Daniel
  • 394
  • 6
  • 15
0
votes
0 answers

Preserve type information in generic functions

I'm trying to chain together input parsers for a procedure in trpc, but because of the type ProcedureBuilder, chaining loses information. I've been digging around for the type wizardry, but I can't seem to figure it out. Any suggestions would…
0
votes
1 answer

Is it possible to have TRPC + Docker containers?

HI my question is is it possible and if yes how to have dockerized frontend with TRPC and backend TRPC? On local development its fine because in monorepo you build backend, frontend and link routers just fine. However if you try to dockerize…
0
votes
0 answers

How to correctly initialise a tRPC router for NextJS

I've currently started migrating a NextJS and Express app to use tRPC. However, I'm having trouble initialising the NextApiHandler. In the backend folder, I have the following files: trpc.ts import { initTRPC } from '@trpc/server'; const t =…
mmattyboi
  • 13
  • 1
  • 8
0
votes
0 answers

Strip error when using toZod package on TRPC inferred type

toZod is a utility for defining Zod schemas that agree with a TypeScript type. It basically gives you auto-suggested properties for your schema by supplying toZod with a type. If your type ever changes, it will show an error notifying you that you…
tdev
  • 45
  • 1
  • 3
  • 9
0
votes
0 answers

trpc query and loaded content for authenticated user

I want that when user is logged in, on frontend see only logout, without pre-string login. I want that when user is logged, see on frontend only Logout, without pre-string Login. This is my code: const userProfile =…
mxcdh
  • 805
  • 3
  • 10
  • 20