
Basically what the title states, cant read the database. It returns the following error
AppwriteException: The current user is not authorized to perform the requested action.
at Client.<anonymous> (file:///C:/Users/meera/GithubDesktop/PitchFork/node_modules/appwrite/dist/esm/sdk.js:391:27)
at Generator.next (<anonymous>)
at fulfilled (file:///C:/Users/meera/GithubDesktop/PitchFork/node_modules/appwrite/dist/esm/sdk.js:22:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 401,
type: 'user_unauthorized',
response: {
message: 'The current user is not authorized to perform the requested action.',
code: 401,
type: 'user_unauthorized',
version: '0.10.19'
}
}
I am really new to appwrite so help is appreciated.
Here is the code:
import { Client, Account, ID, Databases, Permission, Role, Teams } from 'appwrite';
const client = new Client();
const account = new Account(client);
client
.setEndpoint('https://cloud.appwrite.io/v1')
.setProject('646521b8048d4efcd171');
const databases = new Databases(client);
const promise = databases.listDocuments('646522094815b3cf7be4', '64652215e10e469f9e37');
promise.then(function (response) {
console.log(response); // Success
}, function (error) {
console.log(error); // Failure
});
// create the user session
account.createEmailSession('me@example.com','password').then(function (response) {
console.log(response); // Success
}, function (error) {
console.log(error); // Failure
});

Everything seems fine.

Cannot read the Database

why is it giving me the error?

In your Appwrite console add permission to the collection

??

ok

you mean a create a collection called Permission?


You'll need to go to Settings
tab inside your collection

Then you can add and set permission for user(s) group

In my example you can see Any
have access to Read
this collection

yep

got it

it works

tysm @Binyamin

[SOLVED] Cannot read the Database
Recommended threads
- Resource limit
I am getting resource limit errors even tho i didnt exceeded
- Asynchronous Function Execution via Func...
Hi everyone, Is there a way to call a function via its function domain URL with async execution set to true?
- Server Error when upserting existing and...
Hello there! Im currently experiencing issues with the not so long ago officially announced upserting funcionality. Im running appwrite 1.7.4 self hosted and no...
