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
- No server error on selfhosted appwrite
Please help me, my clients is ask what happen on their data? How can i make it up again?
- Upgrading selfhost version?
It is okay to upgrade version to higher one, of my current version is 1.7.4 to 1.8.1. Is that safe to do cause my clients already have data on that? Also is a...
- Local Serverless Function Testing: Are D...
I have followed the instructions to get the CLI working, and have been able to log-in, initialize my project, and created a simple Python function, which calls ...