-
Notifications
You must be signed in to change notification settings - Fork 257
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
Query Plan produces invalid query for subgraphs when they define a stub for an entity that belongs to a merged union #2307
Comments
Sorry for missing this earlier, but this is the same as #2256 and is due to the supergraph unfortunately not preserving enough informations about unions. It's fixed (by #2288) in the upcoming 2.3 release (which we hope to have out within the next week or 2) but as it requires changing the format of the supergraph slightly, it's hard to backport to earlier release unfortunately. |
Closing as I'm fairly confident that it is fixed by the PR mentioned above, but of course feel free to re-open if you still see issues with this once 2.3 is out. |
Hello. I did a test using When I make a query and the requested field is a union, the gateway is sending the request to the subgraph that does not have the declaration of the type in the union. The field should be resolved in another subgraph where the type is declared in the union, but we are getting a location unavailable error. |
Hi, @pcmanus, sorry for the long break. We only could test the fix right now. As @tiago154 mentioned, the query planner seemingly still produces invalid queries for this scenario when the managed federation process builds the supergraph. Are you able to reproduce this? Is it worth reopening this issue? |
Hi @tiago154 and @mNalon. Are you saying that you have the same problem with the exact example from the description for this issue? Or is that a slightly different example? I just tested the example in the description of this issue on current If the problem is with another example or some variation of it, then that modified example would help. |
Thanks for the quick reply @pcmanus. I think I got what was going wrong. Previously our workaround was adding the type C in the union sorry for the false alarm! |
While federating another part of our graph we got an unexpected behavior for the query plan.
I will try to summarize with an example to ease the points.
Considering subgraph 1 with the following schema:
And subgraph 2:
The composition of a supergraph composed by those two subgraphs works fine.
And when we do the following query through the supergraph:
even though subgraph 2 does not declare the type A on the Merged union, this query works correctly (as we are expecting considering the union strategy on the composition).
Although, when we do the following query
it results in a bad request coming from subgraph 1, saying that “Merged can never be of type C”. What tells us that gateway is calling subgraph 1 with an invalid query.
Reproduced with latest version of rover/router.
Expected behavior: query plan should not be adding
… on C
on the query sent to subgraph 1.The text was updated successfully, but these errors were encountered: