Federation only working one way

Hello everyone,
I have a strange problem with federation. It works only in one direction. We have the same problem with multiple services. Below a shortend version of the graphql files.

The gate2User returns null because the user service is not called at all.

We are using apollo rover the generate the supergraph.
Apollo router as a federation gateway.
And netflix dgs as service implementation.

working query:

{
	user {
            shortName
            gate2Cs {
                id
                number
            }
    }
}

NOT working query:

{
	c(id) {
            id
            number
            gate2UserId
            gate2User {
                shortName
            }
	}
}

The problem is that the user-service is not called at all when using the not working query and so the resulting value of gate2User is null.
The rest of the values are returned.

graphql service c:

type Query {
    c(id: String, language: String = "en"): C
}

type C @key(fields: "id") {
    id: ID!
    number: String
    gate2UserId: String
    gate2User: User
}

type User @key(fields: "id") @extends {
    id: ID! @external
    shortName: String @external
    gate2C: [C!]! @requires (fields: "shortName")
}

service user:

type Query {
    user(id: String): User
}

type User @key(fields: "id") {
    id: ID!
    shortName: String
    name: String
}

type C @key(fields: "id") @extends {
    id: ID! @external
    gate2UserId: String @external
    gate2User: User @requires (fields: "gate2UserId")
}

supergraph-config:

federation_version: =2.3.1
subgraphs:
  service-c-v3:
    routing_url: http://service-c-v3/graphql
    schema:
      file: ./subgraphs/service-c-v3.graphql
  service-user-v3:
    routing_url: http://service-user-v3/graphql
    schema:
      file: ./subgraphs/service-user-v3.graphql

router config:

supergraph:
  listen: 0.0.0.0:8085
  introspection: true
include_subgraph_errors:
  all: true
headers:
  all:
    request:
      - propagate:
          named: "Authorization"
      - propagate:
          named: "<censored>"
override_subgraph_url:
    service-c-v3: http://localhost:8080/c/v3/graphql
    service-user-v3: http://localhost:8082/user/v3/graphql

Hello :wave:
Without actual code that reproduces the issue I cannot say for sure but your schema is somewhat confusing and I don’t think is correct, i.e.

  • within service c you define C.gate2User: User field which would imply this field is to be resolved locally
  • within service user you define the same field that is added as a new functionality to the C type

What is the expected behavior? Since you have user service, I’d assume that is the owner of the User type and subject matter expert on how to resolve user information → i.e. the gate2User field defined in the user is the one you want and the duplicate field definition from service c should be removed.

Thanks,
Derek

Hello dkuc,
yes you are correct.
That is a copy&paste error when I prepared the version for this post:
please ignore: within service c you define C.gate2User: User field which would imply this field is to be resolved locally
Please ignore that.

please close this ticket. I found the problem on my end