Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Alias fields return null from the application schema #2429

Closed
email2vimalraj opened this issue May 15, 2018 · 3 comments
Closed

Alias fields return null from the application schema #2429

email2vimalraj opened this issue May 15, 2018 · 3 comments
Assignees
Labels
bug/0-needs-info More information is needed for reproduction.

Comments

@email2vimalraj
Copy link

Bug Report

Current behavior
When we use some alias for the fields while querying, we are getting null despite having data for those fields.

Reproduction
I've create a github repo which can be used to reproduce the issue:
https://github.com/email2vimalraj/prisma-alias-field

Expected behavior?

{
  "data": {
    "usersGroupedPosts": [
      {
        "name": "Vimal",
        "notPublished": [],
        "publishedPosts": [
          {
            "title": "Some title"
          }
        ]
      },
      {
        "name": "Bhuvana",
        "notPublished": [
          {
            "title": "Pending title"
          }
        ],
        "publishedPosts": [
          {
            "title": "New title"
          }
        ]
      }
    ]
  }
}

Actual behavior

{
  "data": {
    "usersGroupedPosts": [
      {
        "name": "Vimal",
        "notPublished": null,
        "publishedPosts": null
      },
      {
        "name": "Bhuvana",
        "notPublished": null,
        "publishedPosts": null
      }
    ]
  }
}
@email2vimalraj
Copy link
Author

@marktani : Any help here?

@marktani marktani added the bug/0-needs-info More information is needed for reproduction. label May 24, 2018
@email2vimalraj
Copy link
Author

@marktani : I'm trying to build the codebase and see if I can fix by myself and contribute back. But unfortunately, I'm failed. The contribution documentation need to be updated on steps to build the code base atleast that would help the beginners like me.

@divyenduz
Copy link
Contributor

Hi, @email2vimalraj Thanks for sharing this bug report and the reproduction repository (always helps and speeds up the process).

Essentially, you are running into this issue and a solution for it is already live with latest version of graphql-yoga.

But the reason that solution is not working for you is this issue i.e. custom resolver does not work with tracing and cacheControl yet.

So, a temporary workaround is to start your server as follows:

const options = {
 tracing: false,
 cacheControl: false
};

server.start(options, () =>
 console.log("Server is running on http://localhost:4000")
);

I am closing this issue as other issues are already open to tackle the underlying problem. Please feel free to reopen in case you need further help.

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug/0-needs-info More information is needed for reproduction.
Projects
None yet
Development

No branches or pull requests

4 participants