Hi, is anyone here familiar enough with Prisma Cli...
# orm-help
g
Hi, is anyone here familiar enough with Prisma Client to help me out with an issue?
d
Hey šŸ™‚ I would love to help you out. Please let me know.
g
Hi thank you!
I’m trying to use Prisma Client by following the example here - https://github.com/prisma/graphql-prisma-typescript
I define a User ā€œmaskā€ type
Copy code
type User {
  id: ID!
  firstName: String!
  lastName: String!
  email: String!
  cart: Cart!
  subscription: Subscription
}
in my
schema.graphql
However, when I try to perform a query on the db with Prisma Client e.g.
Copy code
const user = await ctx.db.user({ email })
I get errors
Message: Unknown type "UserWhereUniqueInput"
and
cannot query field
for each field not included in my mask
d
Interesting. Can you please create an issue here https://github.com/prisma/prisma/issues/new?template=bug_report.md With all the details about your specific datamodel and possible a reproduction? We will look into this right away!
g
My understanding though, is that the Prisma Client query should read the types from
./generated/graphql.js
Will do šŸ‘
d
Thanks! Yes, your understanding looks correct. A reproduction will help us expedite the fix, if needed šŸ™‚
g
Can I ask you another quick question for clarification?
When you use Prisma Client, do you define a seperate ā€œmaskedā€ schema for all types of do you still also import types from a generated schema e,g,
# import Post from './generated/schema.graphql'
?
As is the convention in Prisma-Bindings
d
It is similar. You can see the generated schema in the generated folder. Although, to make the generate command work offline without a real deployed service we have a helper package that converts
datamodel.graphql
to a GraphQL JS Schema => https://github.com/prisma/prisma/tree/beta/cli/packages/prisma-generate-schema
g
ok thanks
l
@Grant I believe that behavior is correct because email is not marked as unique. If you put the ā€˜@unique’ directive on email, it should work.
Err, I think you defined your server type above. Sorry about that. Does your Prisma datamodel have email as unique? (Why you shouldn’t answer things on your phone :) )
g
@lawjolla Thanks for the help. This was all colpa mia. I had accidentally defined the wrong
PRISMA_ENDPOINT
in my
.env
so that the GraphQLServer was pointing to itself on
<http://localhost:4000>
. This resulted in some strange behaviour and is why only the fields defined in my user mask schema type were recognised!