You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @miguelwebtales. The issue, at least in the linked demo, is a dependency issue. Looking at [the package.json|https://github.com/miguelwebtales/federated-alias-bug-example/blob/master/package.json] file, you have:
but you really need to use the same version for the gateway and query-planner. My advice would be never manually list the dependency on @apollo/query-planner, so it always get pulled as a dependency of @apollo/gateway with the proper version.
The longer answer is that the transformation of the alias (from broken_alias to broken_alias__alias_0) in the subgraph query is done as a way to avoid the bug described in #1257 (which doesn't affect the particular query of this example, but the fix is a bit conservative and triggers in this case too). The alias transformation happens because you are using a "newer" query planner (2.3.2), but it relies on the gateway knowing how to handle it and that is not the case of gateway 2.0.5.
We do not, in general, support mismatched versions of the gateway and the query planner, because some fixes (like the one here) require cooperation between the plan generation side (the query planner) and the plan execution side (the gateway). But we could probably make a better job at warning about this/documenting this ...
Closing as I've validated that updating the dependency of @apollo/gateway to ^2.3.2 does fix the issue in the demo above. But I've also created #2409 to follow up on ideas to improve the experience when versions of packages are mismatched in incompatible ways.
I am getting two different behaviours depending if I request the query bellow on the subgraph or the gateway.
Running this query on the subgraph the expected/correct output is returned.
But running the same query on the gateway the alias "broken_alias" fails and returns null.
The query planner for the above query is the following one:
As we can see the alias "broken_alias" is transformed into "broken_alias__alias_0" on the User Inline Fragment, probably causing this issue.
Is this a bug or a limitation using aliases on the gateway?
You can find a demo with this problem here: https://github.com/miguelwebtales/federated-alias-bug-example
The text was updated successfully, but these errors were encountered: