Skip to content

Missing useful message in composition error #2712

@sjackson-brex

Description

@sjackson-brex

Description

When testing rover supergraph composition on a bad graphql schema to make sure we were handling the errors properly, we hit a case where the rover error message was not only unhelpful, but confused us about our own system. The message portion of the error response was reading [object Object] which lead us to believe our system was improperly handling the rover response. Only once we reproduced the behavior locally did we fully realize it was directly from the rover CLI JSON response itself.

Steps to reproduce

To set up the awful bad supergraph to compose, we have two files:

rover_config.yaml:

federation_version: =2.9.0
subgraphs:
  test:
    routing_url: https://test.example.com/
    schema:
      file: ./invalid_subgraph.graphql

invalid_subgraph.graphql:

invalid graphql schema

We use rover to compose this into a supergraph:

rover supergraph compose --config ./rover_config.yaml --format json

When run, this produces the following result:

{
    "json_version": "1",
    "data": {
        "success": false
    },
    "error": {
        "details": {
            "build_errors": [
                {
                    "message": "[object Object]",
                    "code": "INVALID_GRAPHQL",
                    "type": "composition",
                    "nodes": [
                        {
                            "subgraph": "test",
                            "source": "invalid graphql schema",
                            "start": null,
                            "end": null
                        }
                    ],
                    "omittedNodesCount": 0
                }
            ]
        },
        "code": "E029",
        "message": "Encountered 1 build error while trying to build a supergraph."
    }
}

Expected result

Rover composition should fail and give a useful message about the failure in the error->details->build_errors->message field about why the graph is invalid or what may have happened.

Actual result

The message simply says "[object Object]" which sent us into a search for where we weren't properly deserializing things but in fact it was rover itself.

Environment

rover info
Rover Info:
Version: 0.35.0
Install Location: /Users/sjackson/.rover/bin/rover
OS: Mac OS 15.6.1 [64-bit]
Shell: /bin/zsh

reproduced on linux and macos.

Apollo Studio Plan: enterprise

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐞triageissues and PRs that need to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions