router
router copied to clipboard
Router v2.2.1 can't handle progressive overrides < 100%
Describe the bug
We have three subgraphs:
- Subgraph A (old subgraph to be replaced)
- Subgraph B (new subgraph. new tech stack. Should replace A)
- Subgraph C (provides other metadata)
Subgraph A provides image metadata that is federated into entities from subgraph C. Subgraph B is now to take over the image metadata from subgraph B and thus tries to apply progressive overrides for the migration.
Subgraph A has all fields of the entities in question annotated with @shareable, Subgraph B has the same fields annotated with @override and a label with the corresponding percent for the override. Subgraph A additionally lets the type implement an interface, subgraph B doesn't.
If we now apply any percentage less than 100 to the entity fields in question, Router encounters a federation error when entities from subgraph C are fetched with federated entities from subgraph A/B.
To Reproduce
Take a subgraph A with the following schema:
interface IImage {
id: ID!
absoluteUri: String!
}
type Image implements IImage @key(fields: "id") {
id: ID! @shareable
absoluteUri: String! @shareable
}
extend type AssetMetadata @key(fields: "id") {
id: ID! @external
image: Image @shareable
}
Then take a subgraph B with the following schema:
type Image @key(fields: "id") {
id: ID!
absoluteUri: String! @override(from: "subgraphA", label: "percent(1)")
}
type AssetMetadata @key(fields: "id") {
id: ID! @external
image: Image @override(from: "subgraphA", label: "percent(1)")
}
And subgraph C with the following schema:
type Query {
assetMetadata(id: ID!): AssetMetadata
}
type AssetMetadata @key(fields: "id") {
id: ID!
name: String!
}
Issuing the following query:
query TestQuery($id: ID!) {
assetMetadata(id: $id) {
__typename
id
name
image {
absoluteUri
}
}
}
Leads to the following error:
{
"data": null,
"errors": [
{
"message": "value retrieval failed: Federation error: An internal error has occurred, please report this bug to Apollo.\n\nDetails: Was not able to find any options for absoluteUri: This shouldn't have happened.",
"extensions": {
"code": "INTERNAL_SERVER_ERROR"
}
}
]
}
Expected behavior
Progressive override should work with any percentage less than 100 and should not lead to the issues described.
Output
The Router delivers the following output when a property from an entity handled by the affected subgraphs is requested:
{
"data": null,
"errors": [
{
"message": "value retrieval failed: Federation error: An internal error has occurred, please report this bug to Apollo.\n\nDetails: Was not able to find any options for absoluteUri: This shouldn't have happened.",
"extensions": {
"code": "INTERNAL_SERVER_ERROR"
}
}
]
}
Environment:
- Apollo Rover 2.2.1 deployed to Kubernetes
Additional context
Nothing right now. Happy to add more if necessary.