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

Aliasing a field to a @key field name yields Rust query planner error #6222

Open
carldunham opened this issue Nov 2, 2024 · 5 comments
Open

Comments

@carldunham
Copy link

carldunham commented Nov 2, 2024

Describe the bug

Demonstrated in https://github.com/carldunham/apollo-router-6222.

Given the attached schema, this query

query Broken {
  animals {
    id: name
    name
    hello
  }
}

will succeed, but the logs show

2024-11-02T20:28:04.778921Z WARN  Rust query planner error in query `Broken`: An internal error has occurred, please report this bug to Apollo.

Details: Cannot merge field selection for field "Animal.name" into a field selection for field "Animal.id"

Similar queries will provide correct results and no issues logged:

query Works {
  animals {
    id
    name
    hello
  }
}

query WorksToo {
  animals {
    ident: id
    name
    hello
  }
}

To Reproduce

Steps to reproduce the behavior:

  1. Clone the provided repo
  2. Link, download, or copy whatever version of rover and router you want to test with
  3. Run make supergraph run
  4. Execute the provided query in the sandbox
  5. See error in Router log
  6. (if you want to see results, run the subgraph services like (cd a && make run)

Expected behavior

No issues logged.

Output

See above.

Desktop (please complete the following information):

  • OS: MacOS
  • Version 15.0.1

Additional context

Tested with various recent versions, up to

  • Rover v0.26.2 with federation =2.9.0
  • Router v1.57.0
@carldunham carldunham changed the title (pending) aliasing a field to a @key field causes federation failure Aliasing a field to a @key field name yeilds Rust query planner error Nov 2, 2024
@carldunham carldunham changed the title Aliasing a field to a @key field name yeilds Rust query planner error Aliasing a field to a @key field name yields Rust query planner error Nov 2, 2024
@carldunham
Copy link
Author

Note that setting

experimental_query_planner_mode: new

results in a query failure, naturally:

{
  "errors": [
    {
      "message": "value retrieval failed: Federation error: An internal error has occurred, please report this bug to Apollo.\n\nDetails: Cannot merge field selection for field \"Animal.name\" into a field selection for field \"Animal.id\"",
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR"
      }
    }
  ]
}

@goto-bus-stop
Copy link
Member

Thanks for the report. This is a known issue, I don't think we have a specific time frame in mind for addressing it (potentially after we remove the JS implementation of query planner from the router)

@carldunham
Copy link
Author

potentially after we remove the JS implementation

But this would be a regression in Rust, no?

@goto-bus-stop
Copy link
Member

I believe JS silently does the wrong thing in this case 🙈 (overwriting the aliased selection)

@carldunham
Copy link
Author

Indeed it does!

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

No branches or pull requests

2 participants