'Resolve reference not called when using custom directives

I am currently using custom directives to handle authorization across mutations and queries for my subgraphs. However, I realized that when I wrap my schema in the custom directive function using mapSchema (I created the custom directive with this) from graphql-tools, the __resolveReference function for a particular entity is not being called. But when I pass the schema returned from the buildSubgraphSchema function directly to the Apollo server constructor, everything works fine. Any idea what I could be doing wrong.? Thank you!

Schema returned from buildSubgraph

let schema = buildSubgraphSchema({typedefs, resolvers})
const server = new ApolloServer({schema}) // __resolveReference is called 

Schema returned from directive

let schema = buildSubgraphSchema({typedefs, resolvers})
schema = authDirectiveTransformer(schema)
const server = new ApolloServer({schema}) // __resolveReference is not been called on entities.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source