I am getting an Invalid roles
response when creating a team on appwrite with the node-appwrite package. Below is the code I'm using
import Sdk, { Permission, Role } from 'node-appwrite'
const client = new Sdk.Client()
client
.setEndpoint(process.env.SERVER_URI)
.setProject(process.env.PROJECT_ID)
.setKey(process.env.SERVER_API_KEY)
const teams = new Sdk.Teams(client)
await teams.create('comics', 'Comics and Superheroes', [
Permission.read(Role.users()),
Permission.update(Role.team('admin')),
Permission.delete(Role.team('admin'))
])
Below is the error response from the Request.
{
code: 400,
type: 'general_argument_invalid',
response: {
message: "Invalid roles: Value must a valid array and Parameter must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char",
code: 400,
type: 'general_argument_invalid',
version: '1.2.0'
}
}
if I log only the permissions being passed to the server, This is the result
[ 'read("users")', 'update("team:admin")', 'delete("team:admin")' ]
I believe the problem comes from the presence of semicolons and brackets in the strings. How can I resolve that, or am I missing something?