Rank 1: Thread
How can I update the permissions of a document using cloud functions, the code below gives me the aforementioned error:
`import { Client, Databases, Permission, Query, Role } from 'node-appwrite';
export default async function ({ req, res }) {
console.log(req);
const client = new Client()
.setEndpoint(process.env.REACT_APP_APPWRITE_BASE_URL)
.setProject(process.env.REACT_APP_APPWRITE_PROJECT_KEY);
const database = new Databases(client);
try{
const team = "xxx";
const response = await database.updateDocument(
process.env.REACT_APP_APPWRITE_DATABASE_ID,
process.env.REACT_APP_APPWRITE_COMPANIES_COLLECTION_ID,
"yyy",
{},
[
Permission.read(Role.team("team:" + team)),
Permission.update(Role.team("team:" + team)),
Permission.delete(Role.team("team:" + team))
]
);
}catch (error) {
console.log(error);
}
};