Questions tagged [trpc]
67 questions
0
votes
0 answers
Update or create nested records using trpc/prisma
I have an prisma(postgresql)/trpc/next.js that uses referenced tables. So for example I have models that look like:
model Class {
id String @id
name String
lectures Lectures[]
}
model Lectures {
id String @id
text String
classId…

empire29
- 3,729
- 6
- 45
- 71
0
votes
0 answers
T3 stack: Mock TRPC api with jest
Im trying to mock the api to create my first test using the t3 stack. When I run the test it always tells me that api.transactions is undefined. I have a feeling that it is not configured properly to use the ~/ alias. However given the files below…

morraez
- 3
- 2
0
votes
0 answers
TypeError: Cannot read properties of undefined (reading '-1')
I am developing an book inventory form to add book. I use Nextjs and Prisma, tRPC. I don't know why but i have run successfully with this code and the layout is perfect. However, many seconds later, some reason make it have error.
import Head from…
0
votes
1 answer
How can I get supabase auth user data on my tRPC context?
I'm making an application using the t3 stack: next, prisma, tRPC. I'm following along with a certain tutorial that uses Clerk for auth and I'm using Supabase Auth instead. In the file where I define my tRPC procedure (i.e. setting up…

crevulus
- 1,658
- 12
- 42
0
votes
0 answers
T3 project using Repo started failing with The table `main.XYZ` does not exist in the current database
I have been developing a T3 app (Next/Primsa/TRPC) and everything has been working well. I have a local SQLite DB for development. I havent worked on the app in a few weeks, but came back to it and when I try to load views that interact w/ the DB…

empire29
- 3,729
- 6
- 45
- 71
0
votes
1 answer
TypeError: Cannot read properties of null (reading 'useContext') when using useMutation with TRPC
I'm encountering an error in my Next.js application when trying to use the useMutation hook with TRPC (Typed RPC) library. The error message I'm getting is TypeError: Cannot read properties of null (reading 'useContext'). It seems to be related to…

ziyaDev
- 21
- 5
0
votes
1 answer
Calling a tRPC procedure in Next middleware
I want to call my tRPC procedure in my middleware to redirect users who are authed but haven't signed up yet (in my database). Now I obviously can't do useQuery here because it's not a react component, but I also can't write just an API route that I…

zak
- 97
- 9
0
votes
0 answers
tRPC: Query and Mutation on the same route
I'm migrating standard REST Api to tRPC. I had the endpoints:
GET /api/auth (get auth info about a user)
POST /api/auth (auth a user)
In the tRPC router, I cannot add query and mutation to the same route. Obviously, I have an error
TS1117: An…

Evgeny
- 631
- 6
- 17
0
votes
0 answers
tRPC API calls log user out automatically
I'm trying to build a social media application using the T3 stack (Next.js, NextAuth.js, tRPC, Prisma). I have a protectedProcedure route which creates a new post. However, whenever I call this route (or any other route), I get immediately logged…

Ammar Elbehery
- 1
- 1
0
votes
0 answers
Does calling `setData` in `useMutation` affect subsequent calls to `useQuery`'s internal authentication checks?
Does calling setData make the following calls of the respective useQuery ignore the internal authentication checks?
Say I have a getUserList query like this:
getList: publicProcedure
.input(z.object({ listId: z.number() }))
.query(async ({…
0
votes
0 answers
How to create a dynamic subdomains in t3 stack
Anyone know a way to create dynamic subdomains in t3-stack?
I want to be able to build a subdomain system like Hashnode had in the past.
For Example:
test.hashnode.com
example.hashnode.com
abc.hashnode.com
I am using trpc, t3stack and nextjs for…

Ujen Basi
- 11
- 1
- 2
0
votes
0 answers
TRPC Client throws TypeError in React
I get the following Error when I try to use TRPC in my React Project. Otherwise everything works perfectly. In particular, the Api server in which the error allegedly occurs works without errors. So it should actually be a problem in Typescript. I…

lhilgert
- 101
- 1
- 1
- 3
0
votes
1 answer
Prisma query does not return array specified in schema
I am using Prisma to handle database queries.
Currently the database does not return the items array whether it's empty or has entries.
This schema works, I am able to perform CRUD actions.
ShoppingListItems are visible in the items array of the…

bysiuxvx
- 65
- 2
- 10
0
votes
0 answers
Issue making API request using logged in user's credentials
I am using NextAuth and Github to authenticate a user in my app. I am trying to run a TRPC query to return an authenticated user's github repo information.
const response = await fetch(`https://api.github.com/user`, {
headers:…

ETHan
- 187
- 1
- 4
- 17
0
votes
0 answers
NextJS TRPC Invalid Hook Call (Nested)
I've got nested TRPC calls, and when I do this, it throws 'Invalid hook call' in the console of the server. The end goal is, I'm pulling product info from a database, and then looking up the product ID's in my s3 bucket to pull back a list of keys,…

CodeTester9001
- 45
- 6