-
Notifications
You must be signed in to change notification settings - Fork 393
New issue
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
GraphQL request is not triggering the global guard #3024
Comments
I'm experiencing the same problem. I have registered My guard is simple, just logging on GraphQL routes simply ignore the guard meanwhile "@nestjs/apollo": "^12.0.11", |
Is there an existing issue for this?
Current behavior
I have a user role guard that needs to access a TypeORM repository inside. I set it inside my AppModule as a global guard. However, I see that when a GraphQL request comes, it does not go through the guard but simply hits my GraphQL query. Any idea what is going wrong here?
AppModule
UserRightGuard
UserDetailsResolver
Minimum reproduction code
https:/ErangaHeshan/nests-issues-trigger-global-guard#2-a-user-without-proper-access
Steps to reproduce
No response
Expected behavior
I would expect the GraphQL queries annotated using
@RequireRights(['subscription'])
to invoke the guard and check if the user who made the request has appropriateright
value in theiruser_details
table. If the user does not have properright
, the query should returnFORBIDDEN
error inside its response body.Package version
12.0.8
Graphql version
graphql
: 16.8.1@apollo/server
: 4.9.4@nestjs/platform-express
: 10.0.0@nestjs/typeorm
: 10.0.0NestJS version
10.0.0
Node.js version
16.13.2
In which operating systems have you tested?
Other
I discussed the issue with one of the NestJS core team member and here is our discussion on Discord
The text was updated successfully, but these errors were encountered: