Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Router errors on queries that contains only __typename on root level that wrapped in fragment #6154

Open
IvanGoncharov opened this issue Oct 15, 2024 · 0 comments

Comments

@IvanGoncharov
Copy link
Member

IvanGoncharov commented Oct 15, 2024

Describe the bug

Queries like { __typename } works on router but if you wrap it in fragment like this { ... { __typename } } it produces an error:

value retrieval failed: empty query plan. This behavior is unexpected and we suggest opening an issue to apollographql/router with a reproduction.

To Reproduce

See test cases here:

/* FIXME: should be fixed in query planner, failing with:
> value retrieval failed: empty query plan. This behavior is unexpected and we suggest opening an issue to apollographql/router with a reproduction.
#[tokio::test]
async fn inside_inline_fragment() {
let request = Request::fake_builder()
.query("{ ... { __typename } }")
.build()
.unwrap();
let response = make_request(request).await;
insta::assert_json_snapshot!(response, @r###"
{
"data": {
"n": "MyQuery"
}
}
"###);
}
#[tokio::test]
async fn inside_fragment() {
let query = r#"
{ ...SomeFragment }
fragment SomeFragment on MyQuery {
__typename
}
"#;
let request = Request::fake_builder().query(query).build().unwrap();
let response = make_request(request).await;
insta::assert_json_snapshot!(response, @r###"
{
"data": {
"n": "MyQuery"
}
}
"###);
}
#[tokio::test]
async fn deeply_nested_inside_fragments() {
let query = r#"
{ ...SomeFragment }
fragment SomeFragment on MyQuery {
... {
...AnotherFragment
}
}
fragment AnotherFragment on MyQuery {
__typename
}
"#;
let request = Request::fake_builder().query(query).build().unwrap();
let response = make_request(request).await;
insta::assert_json_snapshot!(response, @r###"
{
"data": {
"n": "MyQuery"
}
}
"###);
}
*/

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

No branches or pull requests

1 participant