skuse
Explore posts from serversTTCTheo's Typesafe Cult
•Created by Furki4_4 on 11/24/2023 in #questions
next-auth drizzle adapter customization
hey man, im having trouble with this too, mind sharing your solution?
7 replies
TTCTheo's Typesafe Cult
•Created by skuse on 3/23/2023 in #questions
Prisma p.account.create() error "Column: for"
I've sorted it out.
The spotify access token is 260 characters long, and was exceeding the character limit. Same as my scopes.
I added @db.Text to the fields and this fixed my problem
model Account {
id String @id @default(cuid())
userId String
type String
provider String
providerAccountId String
refresh_token String?
access_token String? @db.Text
expires_at BigInt?
token_type String?
scope String? @db.Text
id_token String?
session_state String?
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([provider, providerAccountId])
}
2 replies
TTCTheo's Typesafe Cult
•Created by skuse on 1/10/2023 in #questions
Environment variables pass on backend but fail on client?
I just seen this, did you fix it?
I was a beginner and tried to call prisma in my client side component eg. _app.tsx
You can only call prisma in a server component because the server communicates with the database (the database is prisma), not the client.
If you called prisma in the client, a user would have access to see everything in the database, we dont want want that. We want to call prisma on the server, get the information we need, then deliver that information from the server to the client.
that's what TRPC is for. You can call trpc on your client, then trpc runs the function you made on the server (this would be like the example router), within this server function you would call prisma, prisma will give you what you requested, then you would return the result in the trpc function to the client, which is the
const { data } = trpc.example.useQuery()
I would also recommend you learn the basics of react query so you know what's going on with useQuery and useMutation
Hope this helps!
4 replies
TTCTheo's Typesafe Cult
•Created by skuse on 1/10/2023 in #questions
Environment variables pass on backend but fail on client?
FIXED. Was trying to call prisma from client but needed to do it in server.
4 replies