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