apollographql / rover

The CLI for Apollo GraphOS
https://rover.apollo.dev
Other
404 stars 84 forks source link

Error at generating super-graph for federation 2.0: argument "fields" should have type "_FieldSet!" but found type "FieldSet!" #1866

Closed kirill-d-lappo closed 1 month ago

kirill-d-lappo commented 6 months ago

Description

I am having error at generating supergraph schema with rover on my dev env.

The schema was generated for federation v 2.0 using hotchocolate packages with apollo federation package in dotnet service

I set federation_version: "=2.0.0" in rover configuration, and the schema is for v2 (as I understand) but rover shows errors.

Steps to reproduce

  1. Prepare a schema (or subgraph service with such a schema) for federation 2.0 where key, provides and requires directive definitions look like that:

    directive @key(fields: FieldSet! resolvable: Boolean = true) repeatable on OBJECT | INTERFACE
    directive @provides(fields: FieldSet!) on FIELD_DEFINITION
    directive @requires(fields: FieldSet!) on FIELD_DEFINITION
  2. Prepare rover config file (./rover.yaml):
    federation_version: "=2.0.0"
    subgraphs:
      subgraph-name:
        routing_url: http://localhost:8084/graphql
        schema:
          subgraph_url: http://localhost:8084/graphql?sdl
  3. Run rover with command:
    rover supergraph compose --config "./rover.yaml" --output "./supergraph.yaml"

Expected result

Rover must generate supergraph scheme using provided subgraphs

Actual result

Errors happens

⌛ resolving SDL for subgraphs defined in ./config.rover.localhost.yaml
🎶 composing supergraph with Federation v2.0.0
error[E029]: Encountered 6 build errors while trying to build a supergraph.

Caused by:
    UNKNOWN: [subgraph-name] Invalid definition for directive "@key": argument "fields" should have type "_FieldSet!" but found type "FieldSet!"
    UNKNOWN: [subgraph-name] Invalid definition for directive "@requires": argument "fields" should have type "_FieldSet!" but found type "FieldSet!"
    UNKNOWN: [subgraph-name] Invalid definition for directive "@provides": argument "fields" should have type "_FieldSet!" but found type "FieldSet!"

Environment

Rover Version: 0.21.0 (same for 0.23.0-rc.3) Install Location: /home/klappo/.rover/bin/rover OS: Linux Mint 21.3 (virginia) [64-bit] Shell: /bin/bash Installation method: script and binary download

jonathanrainer commented 1 month ago

Hi @kirill-d-lappo,

I think this might be due to the issue raised here: https://github.com/apollographql/federation-hotchocolate/issues/59, rather than it being an issue with Rover itself. Would you be able to have a look and confirm that for me?

kirill-d-lappo commented 1 month ago

Hi @kirill-d-lappo,

I think this might be due to the issue raised here: https://github.com/apollographql/federation-hotchocolate/issues/59, rather than it being an issue with Rover itself. Would you be able to have a look and confirm that for me?

Sorry, I'm on a vac right now, will be able to check that after July 22th

kirill-d-lappo commented 1 month ago

@jonathanrainer it seems like it is connected to the mentioned issue; let's close that issue, i will send some updates there