
I'm developing a CLI application using Node.js and the node-appwrite
package, but I'm encountering an error
TypeScript
import { Client, Account, ID } from 'node-appwrite';
const client = new Client()
.setProject('runner')
const account = new Account(client);
async function createAccount() {
const data = await account.create(ID.unique(), 'me@domain.com', '123456789', 'John Doe');
console.log('Account created:', data);
}
async function login() {
const data = await account.createEmailPasswordSession('me@domain.com', '123456789');
console.log('Session created:', data);
}
async function getAccount() {
const data = await account.get();
console.log('Account:', data);
}
createAccount();
login();
getAccount();
The error occurs when calling getAccount()
, and the error message is:
TypeScript
AppwriteException: User (role: guests) missing scope (account)
code: "401"
full error
TypeScript
3 | export { Query } from './query.mjs';
4 |
5 | // src/client.ts
6 | var AppwriteException = class extends Error {
7 | constructor(message, code = 0, type = "", response = "") {
8 | super(message);
^
AppwriteException: User (role: guests) missing scope (account)
code: "401"
at new AppwriteException ([redacted]\runner\node_modules\node-appwrite\dist\client.mjs:8:5)
at [redacted]\runner\node_modules\node-appwrite\dist\client.mjs:278:13
TL;DR
Developing a Node.js CLI app with `node-appwrite` package. Error when calling `getAccount()`: "AppwriteException: User (role: guests) missing scope (account)". Solution: The error is due to a missing scope 'account' for the user role 'guests'. Add 'account' scope to the user role.Recommended threads
- mcp-for-docs not working properly
I'm experiencing issues integrating the MCP server tool with Cursor IDE. The MCP server connection establishes successfully initially but fails after one minute...
- How do you strategically secure day's wo...
I worked entire day to try and solve how to use clerk such that it handles checking user's authentication purely server-side. I wasted entire day on a loop of a...
- Creating a relationship with nested obje...
{ "data": { "name": "DiDi", "type": "Software Development", "userJobs": [{ "$id": "68cbf1e2003612fb13ca", "j...
