Back
is it possible to make a document with permissions from Appwrite functions
- 0
- Databases
- Functions
- Flutter
TypeScript
databaseId: databaseId,
collectionId: collectionId,
documentId: userId,
data: {
'userId': userId,
'email': userEmail,
'createdAt': DateTime.now().toIso8601String(),
'lastLogin': DateTime.now().toIso8601String(),
'isActive': true,
},
permissions: [
Permission.read(
Role.user(userId)), // Only the user can read their document
Permission.update(
Role.user(userId)), // Only the user can update their document
Permission.delete(
Role.user(userId)), // Only the user can delete their document
],
);
when i add the permissions in the functions i get an error AppwriteException: user_unauthorized, Permissions must be one of: (any, guests) (401 but when i remove it works fine ,i have selected all 10 of the Scopes for database.
TL;DR
Developers are trying to create a document with permissions using Appwrite functions, but are facing an `AppwriteException: user_unauthorized` error when setting permissions. The error is due to incorrect permissions being set up in the function, as permissions must be limited to `(any, guests)`. Removing the permissions resolves the issue.How are you setting up your appwrite client?
Recommended threads
- I can't UNPAUSE my project with the free...
I received an email notifying me that my project had been paused due to inactivity, and the email included a link to "Restore project." However, that button red...
- How to bypass the rate limit on the back...
Once a month my app has a ton of usage and I always run into the Too many requests 429 error. I am trying to optimize the queues and jobs to manage that, but a...
- Error trying to deploy functions from CL...
✗ Error • on-auth-create (6a00b2ab000c9ce2949b) • Server Error ✗ Error: No functions were pushed. Prject ID: 69ffe0270033a4ac420a