Current behavior
The generated prism.graphql file gets commented out halfway through:

Reproduction




Expected behavior?
I'm trying to run a simple query to get the user with a given facebookID. For now, I forward the given user query to the db, and call it like this:
let user = await ctx.db.query.user({ where : { facebookId : facebookUser.id } })
It's giving me this error message: "Variable \"$_where\" got invalid value {\"facebookId\":\"1066677483399188\"}; Field \"facebookId\" is not defined by type UserWhereUniqueInput."
Please help me fix this! I believe this to be a bug related to the auto-generated file... but maybe I've also wrongly implemented it (I'm very new to Prisma). What do I do?
Just noticed that I wasn't using UserWhereInput and not UserWhereUniqueInput, which I then changed. I also adjusted my query to the following:
user(parent, args, ctx, info) {
return ctx.db.query.user({
where : {
facebookId
}
}, info)
}
I'm still getting an error: "Variable \"$_where\" got invalid value {\"facebookId\":\"1066677483399188\"}; Field \"facebookId\" is not defined by type UserWhereUniqueInput."
Hey @harrysolovay, you are encountering two separate problems.
You receive this error message because your User type does not specify the facebookId to be @unique. Please change line 8 indatamodel.graphql to
facebookId!: String @unique
then prisma deploy and let it regenerate the prisma.ts file. Your original code should then work as expected.
The cosmetic problem has been brought up before by @johannpinson here. He concluded that this requires a change in the graphql-js library, and added a new issue for this here. Please join the discussion there, to raise awareness about this problem 🙂
Let me know if you need further help with your first issue.
Worked like a charm! Thank you!!!
Most helpful comment
Hey @harrysolovay, you are encountering two separate problems.
You receive this error message because your
Usertype does not specify thefacebookIdto be@unique. Please change line 8 indatamodel.graphqltofacebookId!: String @uniquethen
prisma deployand let it regenerate theprisma.tsfile. Your original code should then work as expected.The cosmetic problem has been brought up before by @johannpinson here. He concluded that this requires a change in the
graphql-jslibrary, and added a new issue for this here. Please join the discussion there, to raise awareness about this problem 🙂Let me know if you need further help with your first issue.