You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm using this amazing package to control the queries in our federated ApolloGateway. The problem comes when, following the examples, I always see the schema object passed to the new ApolloServer constructor and, we don't have the schema available at Gateway level.
I would prefer to keep this cost analyser in the Gateway to avoid repeating the config in all the sub ApolloServers we have.
Is there any way to achieve this? Is there something super obvious I'm missing?
The code I'm using is:
exportasyncfunctionbootstrap(){constgateway=createApolloGateway();constapolloServer=newApolloServer({
gateway,plugins: [logErrorPlugin],introspection: (process.env.INTROSPECTION==='true'),debug: (process.env.DEBUG==='true'),formatError: (err)=>{// Don't give the specific errors to the client.if(err.extensions.code.startsWith('DOWNSTREAM_SERVICE_ERROR')){returnnewError('Internal server error from subgraph '+err.extensions.serviceName+'. Logs are in datadog');}returnerr;},context: ({ req })=>{// Get the user token from the headers// Try to retrieve a user with the token// Add the user ID to the contextreturn{ req };},});awaitapolloServer.start();constapp=express();configExpress(app);configApolloServer(apolloServer,app);constserver=awaitstart(app,config.port);attachGracefulHandlers(server);return{ server, app };}
The text was updated successfully, but these errors were encountered:
You need the schema to run the validation. I am not that familiar with Apollo Server, but looks like you should be able to build a plugin that uses this library here:
Hi, I'm using this amazing package to control the queries in our federated ApolloGateway. The problem comes when, following the examples, I always see the
schema
object passed to thenew ApolloServer
constructor and, we don't have theschema
available at Gateway level.I would prefer to keep this cost analyser in the Gateway to avoid repeating the config in all the sub ApolloServers we have.
Is there any way to achieve this? Is there something super obvious I'm missing?
The code I'm using is:
The text was updated successfully, but these errors were encountered: