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

problem with entities with multiple @keys: yoga + federation #3372

Open
endroca opened this issue Jul 16, 2024 · 0 comments
Open

problem with entities with multiple @keys: yoga + federation #3372

endroca opened this issue Jul 16, 2024 · 0 comments

Comments

@endroca
Copy link

endroca commented Jul 16, 2024

Describe the bug

When adding multiple @key directives, the gateway stops making requests to the second subgraph.

interface Media @key(fields: "id") {
    id: ID!
    title: String!
    teste: String @inaccessible
}

type Book implements Media @key(fields: "id") @key(fields: "title"){
    id: ID!
    title: String!
    teste: String
} 

When the second @key directive is added, the gateway no longer knows it should go to subgraph 2, resulting in a GraphQL non-null field error.

Your Example Website or App

https://github.com/endroca/yoga-issue-federation

Steps to Reproduce the Bug or Issue

Run app 1.js 2.js and gateway.mjs

Expected behavior

It was expected that the gateway would go to subgraph 1 and then to subgraph 2, but it only goes to subgraph 1 and returns the error

{
  "errors": [
    {
      "message": "Unexpected error.",
      "locations": [
        {
          "line": 5,
          "column": 5
        }
      ],
      "path": [
        "books",
        0,
        "author"
      ]
    }
  ],
  "data": {
    "books": null
  }
}

Screenshots or Videos

No response

Platform

linux

Additional context

No response

@endroca endroca changed the title problem with entities with multiple @keys - yoga + federation problem with entities with multiple @keys: yoga + federation Jul 16, 2024
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

1 participant