
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
- Unable to create push providers - FCM or...
Currently unable to create a push provider for FCM or APNS.... https://github.com/appwrite/console/issues/2045 When uploading a file... FCM = Valid file retu...
- Stuck in "deleting"
my parent element have relationship that doesnt exist and its stuck in "deleting", i cant delete it gives me error: Collection with the requested ID could not b...
- Help with 409 Error on Relationship Setu...
I ran into a 409 document_already_exists issue. with AppWrite so I tried to debug. Here's what I've set up: Collection A has 3 attributes and a two-way 1-to-m...
