Apollo Gateway engineConfig for managed federation
See original GitHub issueHi. I have been using Apollo Gateway with managed federation for quite some time now and it used to work very well, but recently, I noticed an error in the gateway like this after upgrading dependencies:
Error checking for changes to service definitions: When
serviceListis not set, an Apollo Engine configuration must be provided. See https://www.apollographql.com/docs/apollo-server/federation/managed-federation/ for more information. When
serviceList is not set, an Apollo Engine configuration must be provided. See https://www.apollographql.com/docs/apollo-server/federation/managed-federation/ for more information.
Which did not come before. Since it is a managed federation, I don’t have a serviceList and this is how I used to initialize my ApolloGateway:
import { ApolloGateway, RemoteGraphQLDataSource } from '@apollo/gateway';
const gateway = new ApolloGateway({
buildService(service) {
return new RemoteGraphQLDataSource({
url: service.url,
willSendRequest: ({ request, context }) => {
request.http.headers.set('authorization', context.token);
}
});
},
debug: false
});
const server = new ApolloServer({
gateway,
subscriptions: false,
introspection: true,
playground: {
endpoint: config.apollo.playgroundEndpoint
},
engine: {
apiKey: process.env.ENGINE_API_KEY,
schemaTag: process.env.SCHEMA_TAG
},
context: async ({ req }) => {
// Some code here....
// Return variables
return {variables};
}
});
May I know what changed I have to make? Looks like there are some new parameters but I don’t find any documentation related to that.
For eg. I am not sure what to give in federationVersion
which is a property of ManagedConfig as per this commit: https://github.com/apollographql/apollo-server/commit/f6ba2dea9b4f7c8aa602cad66398685d8bdbc3a2#diff-7b5e66976a637efc823826a985fa8e65
Thanks.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
This has been promoted to
latest
.Thanks for reporting it! I’ll promote this to
latest
in a couple hours.