Hello, I am making a anonymous session in next js server side by doing :
export async function createAnon() {
const client = new Client()
.setEndpoint(process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT as string)
.setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT as string);
const account = new Account(client);
const result = await account.createAnonymousSession();
return result;
}
then I try to convert the anonymous account to a normal one by doing update mail :
export async function createAccountFromAnon(email: string, password: string) {
const client = new Client()
.setEndpoint(process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT as string)
.setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT as string)
.setSession('current');
const account = new Account(client);
const result = await account.updateEmail(
email,
password
);
return result;
}
and I get the following error :
Error: User (role: guests) missing scope (account) lib/server/appwrite.ts (42:20) @ async createAccountFromAnon
40 | const account = new Account(client); 41 |
42 | const result = await account.updateEmail( | ^ 43 | email, 44 | password 45 | );
I am probably missing something here
Recommended threads
- 1.9.5 Migration problem
1.9.5 migration problem after run migration command only openruntimes-executor
- Appwrite Sites deployment fails because ...
Appwrite Cloud Sites deployments are failing consistently for both GitHub and manual deployments. The build command completes successfully and packaging also c...
- Build succeeds but deployment fails — si...
My Next.js 15.5.20 site (standalone output mode) builds successfully on Appwrite Sites, but the deployment fails at the final packaging step with: [sidecar:bui...