Hello I am reading in rows of data from a text file and then writing them as documents to AppWrite. I am the only user that can create, update and delete the documents. The documents can be read by 'Any'. I attach a screenshot of my Permissions. I am running my app locally on my PC. When I run my app I get this error message: Error creating document: AppwriteException: Permissions must be one of: (any, guests)
Here is the code. My understanding is that it is necessary to set the Permissions in the code, based on the example in the page https://appwrite.io/docs/advanced/platform/permissions and confirmed here: https://github.com/appwrite/playground-for-node/blob/master/src/app.js
I created a User and used that user in collection Permissions. I have Document permissions set on. I've copied the code from the AppWrite docs. I have confirmed the variable values for DATABASE_ID, COLLECTION, PROJECT_ID AND ENDPOINT and the UserID.
What am I missing?
await databases.createDocument(
process.env.DATABASE_ID,
process.env.COLLECTION_RESPONSES,
ID.unique(),
{
date: row[0],
firstname: row[1],
surname: row[2],
country: row[3]
},
[
Permission.read(Role.any()),
Permission.update(Role.user(process.env.USER_ID),"verified"),
Permission.write(Role.user(process.env.USER_ID),"verified"),
Permission.delete(Role.user(process.env.USER_ID), "verified")
]
);
Recommended threads
- Type Mismatch in AppwriteException
There is a discrepancy in the TypeScript type definitions for AppwriteException. The response property is defined as a string in the type definitions, but in pr...
- What Query's are valid for GetDocument?
Documentation shows that Queries are valid here, but doesn't explain which queries are valid. At first I presumed this to be a bug, but before creating a githu...
- Appwrite exception: user_unauthorized, t...
After refreshing the app it is working perfectly