You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have set up all the roles properly and have used decorators in my controller, but it throws an error. What am I doing wrong here, I followed the documentation.
[Nest] 29258 - 04/28/2020, 12:11:35 PM [ExceptionsHandler] Cannot read property 'roles' of undefined +14527ms
TypeError: Cannot read property 'roles' of undefined
at /redacted/node_modules/nest-access-control/decorators/user-roles.decorators.js:11:45
at /redacted/node_modules/@nestjs/core/helpers/context-utils.js:32:28
at resolveParamValue (/redacted/node_modules/@nestjs/core/router/router-execution-context.js:139:31)
at Array.map (<anonymous>)
at pipesFn (/redacted/node_modules/@nestjs/core/router/router-execution-context.js:144:45)
at /redacted/node_modules/@nestjs/core/router/router-execution-context.js:36:36
at InterceptorsConsumer.intercept (/redacted/node_modules/@nestjs/core/interceptors/interceptors-consumer.js:10:20)
at /redacted/node_modules/@nestjs/core/router/router-execution-context.js:45:60
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async /redacted/node_modules/@nestjs/core/router/router-proxy.js:8:17
The text was updated successfully, but these errors were encountered:
ruslanguns
added a commit
to ruslanguns/nest-access-control
that referenced
this issue
May 10, 2020
That happens because ACGuard has the asumption that you are saving the roles in the user header. Make sure to make it accesible in the user object by req.user.roles
I have set up all the roles properly and have used decorators in my controller, but it throws an error. What am I doing wrong here, I followed the documentation.
Roles
Controller
req.user
givesThe error
The text was updated successfully, but these errors were encountered: