Are input types inherently broken? I used the SDL...
# orm-help
j
Are input types inherently broken? I used the SDL converter and I am getting this error: Could not find argument username for type User Prisma Playgrounds autocompletes username in the variables section thought. I thought it was my code at first, but now the SDL generated code is throwing the same fit.
h
cc @tgriesser
t
Is there a link to code anywhere to see what’s going on?
That is the branch I made to use the SDL converter instead of hand programming all of my schema.
t
I don’t see anything wrong with the input types on nexus’ end… just ran your branch (without prisma) with :
Copy code
mutation {
  createUser(data: {username: "Something", password: "Something Else"}) {
    id
  }
}
and changed the resolve of
createUser
to:
Copy code
resolve(root, args, ctx) {
  const { data } = args;
  console.log(args);
  return { id: 1 };
}
and I see
{ data: { username: 'Something', password: 'Something Else' } }
in the console, so the input types seem to be working fine there. Maybe it’s something in the translation to prisma’s end? @weakky any idas here?
w
Hey, could you please share the stacktrace? We can’t know where’s the problem coming from with such a little input 😕
j
Here is the error message I get. I will also post my screen from playground.
This same query worked perfectly in my prisma playground. Just not the graphql-yoga playground. Here is the query in the graphql-yoga playground.
w
Yeah so that’s an issue with the generated resolvers in
nexus-prisma
. Does your
User
type in your datamodel looks like this?
Copy code
type User {
  id: ID! @unique
  username: String! @unique
}
Actually, this is really weird
j
No it looks like type User { id: ID! @unique username: String! password: String! posts: [Post!]! }
w
Are you sure you have a properly generated
prisma-client
?
j
yes
The schema from prisma-client was also the one I used in the converter.
Any updates on this issue?
w
The issue is for sure not on
nexus-prisma
side, you must have an issue with your prisma-client not being properly generated
Delete your
prisma-client
folder and run
prisma generate
again
j
I completely did a git clone and set everything up. Create mutations work, queries don't work, but only when you provide arguments. If you have an empty where object it will work, but that is not useful.
Here is where the error lives in the prisma-client-lib
Instructions does not containe "id" anywhere, only UserWhereInput.
I did a console.log on the arg inside of the find loop and found the following args: where orderBy skip after before first last So it should not be looking for id at this location.
Since the name argument is 'id' from my input this will never work.
This is in Client.prototype.generateSelections in Client.js of prisma-client-lib.
To prove my point even further, the only thing that works on my same query is where:{} because it bypasses all of instructions.reduceRight's logic completely.