Questions tagged [trpc]
67 questions
3
votes
1 answer
tRPC Create/Delete Prisma Record
I am trying to add the functionality to create annd delete a Prisma record from within my component. My router has no errors just getting type errors in my component.
Errors exist at { title, content, assigneeId } }
and { id: id } in the create and…

FunctionUndefined
- 53
- 3
2
votes
1 answer
tRPC/react-query, component doesn't receive results of any useQuery until all queries are complete
I can't figure out why react query (in this case wrapped by tRPC) is behaving this way.
Say we have a component that makes two API calls to get some data.
export const MyComponent = () => {
const sample1Result =…

C G
- 31
- 4
1
vote
1 answer
Handling middleware in tRPC, calling multiple methods for one route?
I'm doing a group project that we only have a couple weeks to complete. We've decided to use the T-3 stack and have selected tRPC to build the server. I'm only familiar with express and have not found much help online with learning tRPC. I've got…

Alan B.
- 23
- 4
1
vote
1 answer
trpc and prisma securing records
I am exploring making a T3 app (next/trpc/prisma) there the ~entire experience is behind login (Clerk for now).
All content in the DB is private, meaning that only the User's that are part of the same Group should have access to CRUD it.
Are there…

empire29
- 3,729
- 6
- 45
- 71
1
vote
1 answer
Send blob (image) from frontend to backend with nextjs and trpc (T3 stack)
I'm trying to send a picture of a leaflet map from the backend to the frontend where i use the leaflet-simple-map-screenshoter library for taking the image. This returns a blob which i want to send to the backend so I can save it into a PDF. I am…

Olav Ausland
- 58
- 8
1
vote
1 answer
How to make a tRPC server return plain text?
Generally a response from tRPC server looks like:
{
"result": {
"data": "OK!"
}
}
But what I need is only:
OK!
How do I attain this?
Sorry for asking this silly question. I'm new to this tRPC thing and still figuring things out.

stack5
- 430
- 2
- 10
1
vote
0 answers
Nextjs Vercel Deployment error only - Application error: a client-side exception
On localhost the application runs flawlessly but on production I'm getting this error when doing a post request on a trpc end point.
Application error: a client-side exception has occurred (see the browser console for more information).
This is what…

Binny.H
- 83
- 6
1
vote
1 answer
How to fix Prisma Unique Type error when deploying to Vercel?
I have the app working directly fine on my local dev env but when deploying to Vercel I got this type error which was not expected.
I'm using Nextjs, Prisma, tRPC.
any hints on what I might be missing?
Code
Vercel deploy log

sumato
- 15
- 2
1
vote
1 answer
How to pass arguments to a tRPC subscription?
const postRouter = t.router({
randomNumber: t.procedure.subscription(() => {
return observable<{ randomNumber: number }>((emit) => {
const timer = setInterval(() => {
// emits a number every second
emit.next({…

boom
- 10,856
- 9
- 43
- 64
1
vote
1 answer
Prisma/React Query Dependent undefined type challenges
I would like to take the output of one query (a TRPC query on Prisma) and use this as the dependent input in a future query.
I followed the dependent documentation for React Query but running into type errors that the return of the first may…

NickP
- 1,354
- 1
- 21
- 51
0
votes
0 answers
Invalid `prisma.dayEvent.create()` invocation: Null constraint violation on the fields: (`id`)
When I'm trying to create event in calendar this error throws:
Invalid `prisma.dayEvent.create()` invocation:
Null constraint violation on the fields: (`id`)
Which is weird cause id have default() in prisma schema
Prisma schema:
model dayEvent {
…

Grayza
- 53
- 10
0
votes
0 answers
Valid value in getStaticProps becomes undefined on server
Using the T3 stack (Nextjs pages router + TRPC + prisma), I am trying to perform certain actions on the server via getStaticProps.
I have two dynamic routes: /[householdId]/shopping-list/[id].tsx
In [id].tsx's getStaticProps I am accessing both…

bysiuxvx
- 65
- 2
- 10
0
votes
0 answers
Components reloading (and closing) when opening new browser tabs of the same application
I am currently developing a professional project in a company using the T3 stack (Next.js, React, Typescript and tRPC) and I am facing an issue with a few of my components which have controlled states to open, like an Modal (with a form to get user…

Vinicius Pinho
- 1
- 1
0
votes
1 answer
Waiting for useMutation status to show a modal based on error
I'm using t3stack for my project (tailwind - typescipt- tRPC)
to use an api. in this app you do this for Example :
const apiResult = api.story.generateStory.useMutation();
no need to pass any function or key.
and to trigger this…

IsoW
- 129
- 2
- 15
0
votes
1 answer
TRPC: JSON response from createNextApiHandler gets interrupted
Issue
Some queries and mutations now produce Unexpected end of JSON input or Unterminated string in JSON at position errors
This started happening after rebuilding with an unrelated update. It works locally, but not on the host.
Stack…

repomn
- 1
- 2