"Invalid `roles` param: Value must a valid array no longer than 100 items and Parameter must contain
- 0
- Auth
- Web
- Cloud
I have this code
await teams.createMembership( 'admin', // The team ID [ Permission.update(Role.user(userRefId)), // Permissions for the user Permission.read(Role.user(userRefId)) ], this.accountForm.value['userName'], // User name userRefId // User ID );
Im usng ID.unique() to generate the values of IDs. I'm sure its in the roles array but I follow the documentation here (https://appwrite.io/docs/advanced/platform/permissions#example-1-basic-usage)
What could be the cause of the error?
The documentation you’ve pointed to is on how to use Permissions / Roles to control access to resources. teams.createMembership() is to add a user to a Team, and set the user’s Roles.
You can see the documentation for teams.createMembership() here
Directly addressing your error here, the roles array (the second parameter in teams.createMembership() should be an array of strings
Recommended threads
- All My Project is Gone
Hello everyone, please help. Why have all my projects suddenly disappeared? I received a warning via email about one of my projects being paused. When I clicked...
- CORS errors in Obsidian custom plugin
Hi, anyone here familiar with obsidian community plugins? In short: it's a local first note app which supports writing your own add-ons / plugin But I keep get...
- > AppwriteException: The requested servi...
When trying to read or write from my database I get the following error: > AppwriteException: The requested service is disabled. You can enable the service from...