Closed BitDesert closed 1 month ago
The nest function seem to be checking if it is an array. Does it have to do with the fact that we're passing an object instead ? It checks if a and b are objects and are merging them via object spread.
same is here:
[Nest] 7605 - 02/06/2024, 1:05:30 PM ERROR [ExceptionsHandler] Spread syntax requires ...iterable[Symbol.iterator] to be a function
TypeError: Spread syntax requires ...iterable[Symbol.iterator] to be a function
at RoleGuard.<anonymous>
The role merger implemented in f540e4475008c1972876528763e3856411e08d52 and referenced in #127 does not work.
With the configuration option
roleMerge: RoleMerge.ALL
and a class decorator@Roles({ roles: ['role1'] })
and a handler decorator@Roles({ roles: ['role2'] })
handler I get the following error atnest-keycloak-connect/guards/role.guard.js:79:36
:https://github.com/ferrerojosh/nest-keycloak-connect/blob/69080fc9efaa750f2ee6148080255bc3d461e691/src/guards/role.guard.ts#L48-L54
This is probably due to Nest not being able to merge the array in the
roles
property. Related Nest function: https://github.com/nestjs/nest/blob/a80df520bc0f5847eece8d1fd0d5a6f10b3ab6a6/packages/core/services/reflector.service.ts#L52-L76Did I implement it wrong or is a custom merge method needed?