Skip to content

GraphQL error paths are missing with a subgraph is down #4548

@smyrick

Description

@smyrick

Describe the bug
If my subgraph is in a nested entity fetch query plan and the subgraph has a service error or is offline, the GraphQL errors reported from Router do not have a path assigned.

To Reproduce
Router version 1.35.0

  • Compose a supergraph of two schemas but only start up the server of the first subgraph that has the root resolver
  • Run a query that does a Flatten across a list
  • Notice the query plan for this is [email protected]
    • In older versions of Router this query plan path made into the GraphQL error path which is invalid
  • However in the error block there is not reference to fieldB and it's path even though it is the causing the error from the Router perspective

Expected behavior
All GraphQL errors have an associated path if we can process the request and send requests to subgraphs

Output
Router 1.35.0
Screenshot 2024-01-24 at 1 42 36 PM

Desktop (please complete the following information):

  • OS: MacOS
  • Version 14.3

Additional context
In previous versions of Router, 1.19.0, we actually has an invalid path that included the at @ symbol from query plans (which brought up this spec clarification graphql/graphql-spec#1073)

Router 1.19.0
Screenshot 2024-01-24 at 1 40 58 PM

For Router 1.35.0

Running this graph: https://github.com/apollosolutions/retail-supergraph

Here is the query:

query {
  searchProducts {
    id
    recommendedProducts {
      id
      reviews {
        id
        body
      }
    }
  }
}

Query plan

QueryPlan {
  Sequence {
    Fetch(service: "products") {
      {
        searchProducts {
          __typename
          id
        }
      }
    },
    Flatten(path: "searchProducts.@") {
      Fetch(service: "discovery") {
        {
          ... on Product {
            __typename
            id
          }
        } =>
        {
          ... on Product {
            recommendedProducts {
              __typename
              id
            }
          }
        }
      },
    },
    Flatten(path: "[email protected].@") {
      Fetch(service: "products") {
        {
          ... on Product {
            __typename
            id
          }
        } =>
        {
          ... on Product {
            upc
          }
        }
      },
    },
    Flatten(path: "[email protected].@") {
      Fetch(service: "reviews") {
        {
          ... on Product {
            __typename
            upc
          }
        } =>
        {
          ... on Product {
            reviews {
              id
              body
            }
          }
        }
      },
    },
  },
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions