Invalid `prisma.course.create()` invocation:

i have this error when i create a schema in next js 14: import { NextResponse } from "next/server"; import { auth } from "@clerk/nextjs/server"; import { db } from "src/lib/db"; export async function POST(req: Request) { const { userId } = auth();
try { const { courseTitle } = await req.json(); if (!userId) { return new NextResponse("Unauthorized", { status: 401 }); } const course = await db.course.create({ data: { userId: userId, courseName: courseTitle, typeCourse: "default" } }); console.log({ course }); return NextResponse.json(course); } catch (e: any) { console.log(e); return new NextResponse("Error creating course", { status: 500 }); } } ------------------ ERROR ------------------------
2 Replies
bizzard
bizzard7mo ago
I met almost same problem! and I can use prisma to search data but can not create.
Portgas D. Miang
Portgas D. MiangOP7mo ago
:c
Want results from more Discord servers?
Add your server