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
It's working on client side
import { Client, Teams } from "appwrite";
const client = new Client();
client
.setEndpoint("endpoint") // Your Appwrite Endpoint
.setProject("projectid"); // Your project ID
export const teams = new Teams(client);
const teamslist = await teams.list();
console.log(teamslist); // <-- get the team of the user
On appwrite function i try to get the team of the same user
@D5 there are here i have shared code that lead to auto block =/
role: guests this means you're unauthenticated.
setSession(userJwt) you shouldn't be passing the JWT to setSession(). it should be setJWT()
Recommended threads
- proccessing problems
A database schema operation is stuck in my Frankfurt project. In the matryq database, the workspaceId attribute of the coaching_activity_entries collection rema...
- User column is processing
I am still encountering the processing tag after creating a column in my database. and its not a network or refresh issue, i have refreshed over and over, shutd...
- Custom API domain is unreachable
Earlier my custom api domain was working fine. Now it seems to be offline without a trace a few hours later. I didn't change anything, all the relevant DNS reco...