graphql-yoga
graphql-yoga copied to clipboard
Graphql-shield not working properly with graphql-yoga and graphql-modules.
Describe the bug
Graphql-shield does not seem to work with graphql-yoga and graphql-modules. I don't know where the issue is. I've reduced the implementation to a short version. Basically there are two query fields. One is protected by a graphql-shield rule and one is not. The one protected by the rule is not returning expected error response to the client. Please check it out.
Your Example Website or App
https://github.com/xoldyckk/yoga_shield_modules_error
Steps to Reproduce the Bug or Issue
Go to this github repo Fork/download the project. Run pnpm install(or npm if you prefer to). Go to url http://0.0.0.0/graphiql. Try making both query1 and query2 and match the responses as written in the resolver code. query2 is protected by graphql-shield rule so it should return an error. But it doesn't.
Expected behavior
I expected to get an errors array with the custom error I defined in graphql-shield rule as the result. But I get something else back as the error.
Screenshots or Videos
No response
Platform
- OS: [Fedora Linux]
- NodeJS: [18.4.0]
-
@graphql-yoga/*
version(s): [e.g. 2.9.2]
Additional context
No response
Has this been resolved?