Rank 3: Container
I try to get team of a user inside appwrite function, but i get this error:
AppwriteException: User (role: guests) missing scope (teams.read)
If i try on client side, it's working fine. I don't understand why.
There is my cloud function sample code
import { Client, Teams } from "node-appwrite";
//... inside function const userJwt = req.headers["x-appwrite-user-jwt"]; const client = new Client() .setEndpoint("https://cloud.appwrite.io/v1") .setProject(process.env.APPWRITE_PROJECT_NAME) .setSession(userJwt); log('X') const teams = new Teams(client); log('Y') const listTeam = await teams.list(); // <-- It's failed log('Z') // <-- Didn't get this log