Panic
Panic
Explore posts from servers
PPrisma
Created by Panic on 10/13/2024 in #help-and-questions
Kinde + Prisma ORM
Hey all having an issue when implementing Kinde on a personal project. Object literal may only specify known properties, and 'kindeId' does not exist in type 'UserWhereUniqueInput'.ts(2353) import {PrismaClient} from "@prisma/client"; import {getKindeServerSession} from "@kinde-oss/kinde-auth-nextjs/server"; import {NextResponse} from "next/server"; const prisma = new PrismaClient(); export async function GET() { const {getUser} = getKindeServerSession(); const user = await getUser(); if (!user user == null !user.id) throw new Error("something went wrong with authentication" + user); let dbUser = await prisma.user.findUnique({ where: {kindeId: user.id} }); if (!dbUser) { dbUser = await prisma.user.create({ data: { kindeId: user.id, firstName: user.given_name ?? "", lastName: user.family_name ?? "", email: user.email ?? "" // Using nullish coalescing operator to provide a default empty string value } }); } return NextResponse.redirect("http://localhost:3000/dashboard"); } I confirmed that the KindeId is unique in my prisma model. Would love a second pair of eyes.
5 replies
KKinde
Created by Panic on 10/13/2024 in #💻┃support
Using Prisma to MongoDB With Kinde
Hello, I'm getting this error when trying to store a user id to a KindeId in my prisma ORM Object literal may only specify known properties, and 'kindeId' does not exist in type 'UserWhereUniqueInput'.ts(2353) import {PrismaClient} from "@prisma/client"; import {getKindeServerSession} from "@kinde-oss/kinde-auth-nextjs/server"; import {NextResponse} from "next/server"; const prisma = new PrismaClient(); export async function GET() { const {getUser} = getKindeServerSession(); const user = await getUser(); if (!user user == null !user.id) throw new Error("something went wrong with authentication" + user); let dbUser = await prisma.user.findUnique({ where: {kindeId: user.id} }); if (!dbUser) { dbUser = await prisma.user.create({ data: { kindeId: user.id, firstName: user.given_name ?? "", lastName: user.family_name ?? "", email: user.email ?? "" // Using nullish coalescing operator to provide a default empty string value } }); } return NextResponse.redirect("http://localhost:3000/dashboard"); } I confirmed that the KindeId is unique in my prisma model. Would love a second pair of eyes.
7 replies