Is it possible to apply graphql middleware when using managed federation

I have seen people apply graphql middleware (like graph-shield) to self-managed apollo federation servers like this:

const { schema: federatedSchema, executor } = await gateway.load();
  const schema = applyMiddleware(
    federatedSchema,
    shield(
      {
        Query: allow,
        Mutation: allow,
      },
      {
        debug: true,
      }
    )
  );
const server = new ApolloServer({
    schema,
    executor});

However, you can’t use this method when you are using a managed gateway without getting the “When a manual configuration is not provided, gateway requires an Apollo configuration” error.

We are using Apollo Studio and I’d like to keep the benefits of using managed federation, however, I need middleware.

1 Like

Sorry not an answer but I’m also interested in this, because if Apollo Federation is ever going to support GraphQL multipart requests then that will probably (if its anything like how its done in Apollo Server) be done via middleware.