federation-subscription-tools icon indicating copy to clipboard operation
federation-subscription-tools copied to clipboard

Subscription with fragments failing

Open TechnoChimp opened this issue 2 years ago • 0 comments

Given a subscription with the shape:

subscription($myId: ID!) {
  myQuery(id: $myId) {
    id
    fieldA {
      filedB {
        ... on UnionTypeA {
          fieldC
          fieldD
        }
        ... on UnionTypeB {
          fieldC
          fieldE
        }
      }
    }
  }
}

My subscription gateway is generating errors from the backend:

[GraphQL error]: Cannot query field "fieldC" on type "MyUnion". Did you mean to use an inline fragment on "UnionTypeA" or "UnionTypeB"?
[GraphQL error]: Cannot query field "fieldD" on type "MyUnion". Did you mean to use an inline fragment on "UnionTypeA" or "UnionTypeB"?
[GraphQL error]: Cannot query field "fieldE" on type "MyUnion". Did you mean to use an inline fragment on "UnionTypeA" or "UnionTypeB"?

Additionally, logging the selection being returned from the buildNonPayloadSelections method is giving the following shape:

id  fieldA { fieldB { fieldC } } fieldA { fieldB { fieldD } } fieldA { fieldB { fieldE } }

It seems the generated selection has dropped the fragments?

TechnoChimp avatar Apr 20 '22 19:04 TechnoChimp