tutorial hell unhandle runtime error
Can anyone help with this? not sure if it is Prisma model problem or how I require prisma went wrong. here is my error message
and my prisma model is
and my router code within
server/router/tweets/ts
looks like
while on the front end it looks like
not sure what went wrong17 Replies
@rithulkamesh
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yeah I am trying to see if I can get a fix
so I added
still the same error
🥲 start to worry if tRPC is too new to use
Could it be a prisma model problem?
@rithulkamesh
no bad advice
we put it in context for you for a reason
the code is correct there
@Lois you have @@unique for tweetId and userId but you're not passing those when you create it
I need to be dumber on this: how should I pass them?
@nexxel
instead of referencing the tweet and user model through
connect
just pass the userid and tweet id as userid and tweetid directlydo you want to jump in a voice channel?
no
ohh sick, let me try it
still got the same error, wondering if it is a frontend problem where I
useMutation
nah its a prisma error
maybe the id you're passing is not unique
anyways google the error idk
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
what are you saying lol
ct3a already creates a client and puts it in trpc context so that you don't have to import it from server/db
I did google it and didn't find much relevant answers also posted on the original vlogger's repo issue and see if anyone knows why
and now
tried to validate it before add a new record, but then it is not updating the like record..
If the error message is still the same, “unique constraint”, clean up your db or use different tweetid and usrId
You can see what parameters you have available for the type on the where clause if you do some control clicking
Usually stuff like this is from your prisma schema being out of sync with the database or with the ts server lagging behind
I’d start by doing ctrl-p and restarting the ts server in VSCode. If that doesn’t fix it just doing some control clicking and finding the type it should be something like Prisma.TweetWhereInputs or Args
That’ll be the generated type
Using the account model that comes with next auth we have this type for the WhereUnique Input:
The compound key on the second line is basically what you are trying to do because of @@unique ([tweetId, userId])
Its slightly different but you can use the same process for understanding what can be passed in. Heres the find many input just to compare
thanks for the answer I will have a look when I am not brain dead🥲
clean up my db, restarted my laptop and new errors appears when I try to seeded prisma and haven't reached the previous error occured. Will try to fix it myself first -- will keep you posted! And happy new year!
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View