We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Even when adding empty middleware to the applyMiddleware function from graphql-middleware, it adds significant overhead to each request.
applyMiddleware
graphql-middleware
The example below shows a case where a query returns a hard-coded large dataset to neutralize the impact of the shield middlewares.
Steps to reproduce the behavior:
Initializing the following shield middlewares:
const A = shield({}); const B = shield({}); const C = shield({}); const D = shield({}); const E = shield({}); const F = shield({}); const G = shield({});
Creating the following Apollo Server (even with a tiny schema):
const createApolloServer = () => { let schema = makeExecutableSchema({ typeDefs: gql` type Car { id: ID! name: String! model: String! } type Query { cars: [Car]! } `, resolvers: { Query: { cars: () => [ // Returning mock data just for the sake of this example { id: 1, name: "1", model: "A" }, { id: 2, name: "2", model: "B" }, // ... { id: 800, name: "800", model: "A" }, ], }, }, }); schema = applyMiddleware(schema, A, B, C, D, E, F, G); const apolloServer = new ApolloServer({ schema, dataSources, context, formatError, }); return apolloServer; };
Run a query:
query Cars { cars { id name model } }
Adding empty middleware should not significantly impact the request handling time.
Adding empty middleware results in noticeable overhead in request processing time.
This issue affects the performance of the graphql-shield package and could impact applications using it for permission handling.
graphql-shield
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Bug report
Describe the bug
Even when adding empty middleware to the
applyMiddleware
function fromgraphql-middleware
, it adds significant overhead to each request.The example below shows a case where a query returns a hard-coded large dataset to neutralize the impact of the shield middlewares.
To Reproduce
Steps to reproduce the behavior:
Initializing the following shield middlewares:
Creating the following Apollo Server (even with a tiny schema):
Run a query:
Expected behavior
Adding empty middleware should not significantly impact the request handling time.
Actual behavior
Adding empty middleware results in noticeable overhead in request processing time.
Additional context
This issue affects the performance of the
graphql-shield
package and could impact applications using it for permission handling.The text was updated successfully, but these errors were encountered: