0
I tried to use Federation in my supergraph.
I have 2 microservices, each one with the own schema:
1. first subgraph has:
type User @key(fields: id) @guard {
id: ID!
firstname: String!
}
2. second subgraph has:
type GraphUnion {
id: ID!
user_id: Int
text: String
user: User! @hasOne
}
type User @extends @key(fields: "id") {
id: ID! @external
}
I make a Type(app/graphql/types) in the second microservice where I extend the User:
final class User
{
public function __invoke($representation): array
{
return [
'__typename' => 'User',
'id' => 23
];
}
}
When I use rover subgraph check …
I received the following
SATISFIABILITY_ERROR: The following supergraph API query:
{
graphUnion {
user {
firstname
}
}
}
cannot be satisfied by the subgraphs because:
- from subgraph "...":
- cannot find field "User.firstname".
- cannot move to subgraph "users", which has field "User.firstname", because type "User" has no @key defined in subgraph "users".
Could someone help me?
I tried to do all the steps from documentation from lighthouse … also from Apollo, but didn’t work
New contributor