Skip to content

Router returns INTERNAL_SERVER_ERROR with “empty query plan” when all planned fields are excluded via @include(false) and only __typename remains. #8784

@DimaPF

Description

@DimaPF

Describe the bug

Router returns INTERNAL_SERVER_ERROR with “empty query plan” when all planned fields are excluded via @include(false) and only __typename remains.

To Reproduce

Steps to reproduce the behavior:

  1. Submit a request like (an operation where):
mutation UpdateRoom($input: RoomUpdateDto!) { updateRoom(input: $input) @include(if: false){ id name } __typename }
  1. See error response:
{    "errors": [
        {
            "message": "value retrieval failed: empty query plan. This behavior is unexpected and we suggest opening an issue to apollographql/router with a reproduction.",
            "extensions": {
                "code": "INTERNAL_SERVER_ERROR"
            }
        }
    ]
}

Expected behavior

A valid data response without internal error, with __typename resolved. e.g. {"data": {"__typename": "Mutation"}}

Environment:

Router version: v1.59.1
Federation/supergraph

Additional context

I also reproduced it with the query GraphQL requests, not only the mutation. e.g.

query GetRoomsForUser {
  Room @include(if: false) {
    getRoomsForUser {
      edges {
        node { id }
      }
    }
  }
  __typename
}

If I change @include(if: false) to true, the request works as expected.
Tried Apollo-Expose-Query-Plan: true, but the environment doesn’t return extensions.queryPlan even for successful requests (which suggests the plugin might be disabled).
Can be related to #6154

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