TypeError: Cannot read property 'reduce' of undefined when trying to edit a role in Users & Permissions Plugin
aminta opened this issue · 6 comments
When trying to edit a role in Users & Permissions Plugin the page briefly loads, then I get "an error occurred" modal and this error in the console:
TypeError: Cannot read property 'reduce' of undefined at Object.getRole (/Users/davide/Sviluppo/App/node_modules/strapi-plugin-users-permissions/services/UsersPermissions.js:200:42) at async Object.getRole (/Users/davide/Sviluppo/App/node_modules/strapi-plugin-users-permissions/controllers/UsersPermissions.js:92:18) at async /Users/davide/Sviluppo/App/node_modules/strapi/lib/middlewares/router/utils/routerChecker.js:79:22 at async /Users/davide/Sviluppo/App/node_modules/strapi-utils/lib/policy.js:68:5 at async /Users/davide/Sviluppo/App/node_modules/strapi/lib/middlewares/parser/index.js:48:23 at async /Users/davide/Sviluppo/Appnode_modules/strapi/lib/middlewares/xss/index.js:26:9 [2020-11-23T18:20:17.225Z] debug GET /users-permissions/roles/2xmxFW0T9DJK0Y6dCYmU (661 ms) 500
Strapi 3.3.3
strapi-connector-firestore ^3.0.0-alpha.22
Thanks for the bug report. I may not get a chance to look at this in depth until next week. From a glance, it seems that the permissions
field doesn't exist on the role
object that is fetched from Firestore.
This could be either
- The
permissions
field isn't set in Firestore, - Or the
permissions
field is being removed by this connector because of some bug
In the meantime before I get a chance to look at this, you could help me to narrow down by checking if #1 is the case. Could you look at the Firestore data in your Firebase Console, look at the "roles" collection, find the document "2xmxFW0T9DJK0Y6dCYmU" and see if there is any value for the permissions
field?
In Firestore I have a "users-permissions_role" collection with a "2xmxFW0T9DJK0Y6dCYmU" document.
Ok and does that document have any value set for the permissions
field?
No, these are the fields:
description : "Default role given to authenticated user." name : "Authenticated" type: "authenticated"
Ok, thanks for that info. I'll take a look at this as soon as I get the chance.
Please try 3.0.0-alpha.23
and let me know if this has resolved it for you?