safak / next-blog

312 stars 315 forks source link

Prisma client error #21

Open Rabeet-5 opened 11 months ago

Rabeet-5 commented 11 months ago

when im putting the data of post in a prisma studio , it gives me this error , Type: undefined Message: Invalid prisma.post.create() invocation:

{ data: { slug: "1", title: "1", desc: "klad", img: "/fashion.png", views: 0, cat: { connect: { ? id?: String, ? slug?: String, ? AND?: CategoryWhereInput | CategoryWhereInput[], ? OR?: CategoryWhereInput[], ? NOT?: CategoryWhereInput | CategoryWhereInput[], ? title?: StringFilter | String, ? img?: StringNullableFilter | String | Null, ? Posts?: PostListRelationFilter } }, user: { connect: {} }, comments: {} }, select: { id: true, createdAt: true, slug: true, title: true, desc: true, img: true, views: true, catSlug: true, cat: true, userEmail: true, user: true, comments: true } }

Argument connect of type CategoryWhereUniqueInput needs at least one of id or slug arguments. Available options are listed in green.

Code: undefined

Query: [object Object]

however ! i have read and change the code , but still i am getting this error while creating posts in prisma studio ,

Untitled

Indula-Perera commented 11 months ago

Select Category And user from category table : click the gray color category and user from the select the category and user

karshdev commented 11 months ago

give all the essential details to prisma for ex-define all foreign keys first an restart ur prisma

AatifxShaikh commented 11 months ago

Try adding all the fields, I was getting the exact same error for like an hour but then somehow it got fixed make sure the category and the user email matches the previously added one

Rabeet-5 commented 11 months ago

yes i found it just select all the required fields like users, categories and tick over them then the issue will be reso lved

On Sat, Oct 14, 2023 at 9:53 PM AatifxShaikh @.***> wrote:

i am getting the exact same error. Did you found any solution

— Reply to this email directly, view it on GitHub https://github.com/safak/next-blog/issues/21#issuecomment-1763038236, or unsubscribe https://github.com/notifications/unsubscribe-auth/A744SA45SDJLWEHKLCMUJATX7K7PRAVCNFSM6AAAAAA5MYMOYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRTGAZTQMRTGY . You are receiving this because you authored the thread.Message ID: @.***>

allanmathenge commented 10 months ago

Failed to commit changes. Invalid prisma.post.create()

Select the user ✅ category ✅ then save.

rohitpatel0011 commented 10 months ago

this error occur ..when you writing manually on category and post..DON'T DO THIS. just click on category Screenshot from 2023-11-07 09-03-06 select to mark a category Screenshot from 2023-11-07 09-03-06 do same thing for user and save. it will works

wayosu commented 9 months ago

@Indula-Perera

Select Category And user from category table : click the gray color category and user from the select the category and user

thanks bro. i have the same error. and this is very helpful.