"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
- Appwrite project paused
I have github student account. The auth has been paused however the database is working fine. I cant see any option to resume from my console panel. It is just ...
- Missing Invoice
Hi! I need help with billing on my account (marelu@gmail.com). I have never received a single invoice by email. My organization has been on the Pro plan since...
- Appwrite Functions cold start
Hello. I'm seeing really long cold starts on Appwrite Cloud Functions and wanted to know if this is expected. My function just authenticates the user, fetches ...