Using GraphQL Shield with GraphQLSchema object not working
alyatwa opened this issue Β· comments
I'm trying to use GraphQLSchema object with shield but it does't work
here is an example
https://repl.it/@alyatwa/shield
Hey @alyatwa π,
Thank you for opening an issue. We will get back to you as soon as we can. Also, check out our Open Collective and consider contributing financially.
https://opencollective.com/graphql-shield
PS.: We offer
priority
support for all financial contributors. Don't forget to addpriority
label once you start contributing π
Hey @alyatwa π ,
Thank you for opening this issue. After some investigation, it seems like this is a bug in graphql-middleware
. Instead of setting up the server with schema returned from applyMiddleware
pass in the original schema and apply middleware as an effect
applyMiddleware(schema, permissions);
server.use(
"/graphql",
graphqlHTTP((request, response, graphQLParams) => ({
schema,
// schemaPermission,
graphiql: true
}))
);
Let me know if that worked for you as well. π
It works now!