I'm using `prisma-bindings`, and finding that if I...
# orm-help
l
I'm using
prisma-bindings
, and finding that if I add keys on my subfields, sometimes the result will be shown as null, even though nodes exist. Does anyone know why that would be? Here's an example:
Copy code
query {
  currentUser {
    organisation {
      usersWithInvite: users(
        where: { invite: { id_not: null } }
      ) {
        id
      }
    }
  }
}
returns:
Copy code
{
  "data": {
    "currentUser": {
      "organisation": {
        "usersWithInvite": null
      }
    }
  }
}
If I add another
users
subselection, the whole query works as expected:
Copy code
query {
  currentUser {
    organisation {
      users {
        id
      }
      usersWithInvite: users(
        where: { invite: { id_not: null } }
      ) {
        id
      }
    }
  }
}
returns:
Copy code
{
  "data": {
    "currentUser": {
      "organisation": {
        "users": [
          ...manyUsers
        ],
        "usersWithInvite": [
            ...manyUsers
        ]
      }
    }
  }
}
The
prisma-bindings
request just passes on the
info
value from the request:
ctx.db.query.user({ where: { id } }, info);
Oddly, the server logs for the first example actually show that response from my Yoga server does include users under the
usersWithInvite
key...
n
@tim2, is my understanding correct that this behaviour of aliases comes from
prisma-binding
?
t
@lewisblackwood on which levels do you have your resolvers defined? It looks like aliases are not resolved properly here
l
hey @tim2 - what do you mean by "levels" here? This is our
currentUser
resolver, which just gets the user ID from the JWT and passes it to the bindings query I showed above. The odd thing is that when I review the logs for my Yoga server, I can see that the data is being returned:
Copy code
Response from <http://localhost:4466>:
{
  "user": {
    "organisation": {
      "usersWithInvite": [
        {
          "id": "cjhj6fv4403vu0820bavvaw97"
        }
      ]
    }
  }
}
t
With levels I mean if you also have a resolver for
Organisation
or
Organisation.users
defined but I guess not. Are you using the latest version of graphql-yoga? It's
1.14.2
. We recently did changes regarding alias resolution that afaik should have fixed this issue
l
Ah I see. No, we don't have resolvers for those. I've just updated the app to run on yoga
1.14.2
and prisma-binding at
2.0.1
. The issue still seems to be present.
n
Could you then provide a bug report here: https://github.com/prismagraphql/prisma-binding? 🙂
l
will do 👍
🙏 1