Description
- Package: @apollo/gateway (but the error is caused by @apollo/federation)
- Version: since @apollo/federation v0.9.1
- Last known working version: v0.6.x
When a federated service's schema contains a Subscription
type and it's loaded by the Apollo Gateway, the following error is returned:
GraphQLSchemaValidationError: [accounts] Subscription -> `Subscription` is an extension type, but `Subscription` is not defined
I understand Subscriptions aren't supported by Federation yet, but having them in the downstream service shouldn't affect the creation of the federated graph.
While debugging the problem, I realized the Gateway was processing the Subscription as an extension type (the same way it does with Query/Mutation), but it's not adding an empty definition type for Subscription
.
To reproduce it, just run the federation demo adding a Subscription
to the accounts
service:
const typeDefs = gql`
extend type Query {
me: User
}
type User @key(fields: "id") {
id: ID!
name: String
username: String
}
type Subscription {
somethingHappened(input: String!): String!
}
`;
Fork including the change above: https://github.com/jsangilve/federation-demo/blob/wip/example_with_subscription/services/accounts/index.js