"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
- GB Hours IS NOT resetting
Hi, I was checking my usage and noticed that all of my usage quotas were reset on August 20, 2026, when my billing cycle renewed. Everything else appears to ha...
- Confused about Appwrite Pro pricing
Hi. I've been subscribed to the $25 Appwrite Pro plan, but I've been getting charged $40. I have two projects on my account. I was wondering where exactly the e...
- How can I disable client-side account re...
Hi everyone! I’m currently building a game backend using Appwrite, and I’d like to prevent users from creating new accounts directly through the client. My go...