Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aliases are not resolved correctly #176

Closed
lewisblackwood opened this issue May 24, 2018 · 3 comments
Closed

Aliases are not resolved correctly #176

lewisblackwood opened this issue May 24, 2018 · 3 comments

Comments

@lewisblackwood
Copy link

lewisblackwood commented May 24, 2018

This bug report is based on this thread in the Prisma slack channel.

I'm using prisma-binding with a graphql-yoga app. In some cases, aliases are incorrectly resolved as null. For example, this query:

query {
  currentUser {
    organisation {
      usersWithInvite: users(
        where: { invite: { id_not: null } }
      ) {
        id
      }
    }
  }
}

returns:

{
  "data": {
    "currentUser": {
      "organisation": {
        "usersWithInvite": null
      }
    }
  }
}

If I add another users subselection to the query, the alias will be resolved correctly:

{
  "data": {
    "currentUser": {
      "organisation": {
        "users": [
          ...manyUsers
        ],
        "usersWithInvite": [
           ...manyUsers
        ]
      }
    }
  }
}

If I look at the logs of the running Yoga server, I can see that data is retrieved for the alias I've used:

Response from http://localhost:4466:
{
  "user": {
    "organisation": {
      "usersWithInvite": [
        {
          "id": "cjhj6fv4403vu0820bavvaw97"
        }
      ]
    }
  }
}
@schickling
Copy link
Contributor

@timsuchanek can you please provide an example on how to use GraphQL/Prisma bindings in combination with aliases?

@nikolasburk please make sure to add this special case regarding aliases to the docs.

@divyenduz
Copy link
Contributor

Hi @lewisblackwood, thanks for raising this issue!

Can you please confirm that if you are using tracing or cacheControl option while starting the graphql-yoga server?

As @timsuchanek suggested in the thread, we had deployed a fix for this but that does not work is tracing or cacheControl options are enabled and tracing is enabled by default with latest version of graphql-yoga - raising a separate issue to see if we need to change that.

For more details and a workaround, please refer to this comment

Thanks!

@lewisblackwood
Copy link
Author

Thanks for the reply @divyenduz. I disabled tracing and that did indeed fix the issue with aliases 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants