Debugging the gateway when things go wrong

I have a fairly simple example involving two subgraphs A and B.

Subgraph A “owns” the type T, but Subgraph B exposes a query q that can return a list of T.
So I’m expecting my gateway, when it receives the results from B, to ask A to resolve each of the returned “stubs” of the form { __typename: 'T', id: <id> }.

Executing the following query against the gateway

q() {
  results {
    __typename
    ... on T {
      id
    }
  }
}

returns the expected response

{
  "data": {
    "q": {
      results: [
        {
          "__typename": "T",
          "id": "1"
        },
        {
          "__typename": "T",
          "id": "2"
        }
      ]
   }
  }
}

However if I add an extra property in the query response shape that triggers the gateway to actually go fetch the T’s from A e.g.

q() {
  results {
    __typename
    ... on T {
      id
      name
    }
  }
}

then I get this:

{
  "data": null
}

In the logs I can see the gateway sending GraphQL query to the subgraph A:

query($representations:[_Any!]!){_entities(representations:$representations){...on T{name}}}, var
iables: {"representations":[{"__typename":"T","id":"1"},{"__typename":"T","id":"2"}]}

and I can also see in the logs of A the successful responses to those queries, but there’s nothing further in the gateway log to indicate an error.

What could I be doing wrong, and does anyone have any tips for logging/debugging the gateway when all the individual steps seem to be working but the response contains no data?

OK I managed to figure this out eventually and the root cause was this classic newb JS error in my subgraph reference resolver:

__resolveReference(reference, ...){
      someMethodThatReturnsTheResolvedReference(reference); // <-- Missing return statement
    }

So dumb mistake but would be helpful if e.g. the RemoteGraphQLDataSource class logged responses from subgraph representaton queries so that it’s easier to spot, and maybe if the apigateway flagged an error if its about to send back a response with null data and no error?