How to get aggregate frontend response server side

Is there a way to get the aggregate response on the server before it gets sent back to the frontend?

I’ve attempted to pull this from the top level resolver query (waiting after it has grabbed the sub-graphs) but it doesn’t appear to actual populate the sub-graph objects (it only shows me the ID).

Is there a hook on the server side that allows me to retrieve the fully loaded query (aggregate) result before being sent back to the client?

I’d like to cache the final result in my memory store.

I’m new to GraphQL so my terminology could be off. Let me know so I can clarify. I can provide examples if needed.


Looks like you can just use a custom plugin with the willSendResponse event:

const willSendResponsePlugin = {
    async requestDidStart(requestContext) {
      console.log('Request started!');
      return {
        async willSendResponse(context: GraphQLRequestContext<BaseContext>) {
            if (context.response.body.kind == "single") {
                if ( {
                    const data =;

Then add the plugin to the ApolloServer:

const server = new ApolloServer({
    plugins: [willSendResponsePlugin]