I did not thoroughly investigate, but the issue does not seem to stem from actual permission errors (despite the error message). My tables have table-level permissions set to create("users/verified"), with row-level security enabled. The rows in question also have read, write, update permissions for my user. There is a 2-way-relationship column, but the row on both ends of the relationship indeed have permissions for my user.
The 401 response message I see upon tablesDB.updateRow(...) is the following: The current user is not authorized to perform the requested action. But I can clearly see that the update is reflected in the row, despite the error indicating otherwise. Maybe it is not the actual update the fails, but another tangent operation that is triggered by the update, the error message from appwrite is not conclusive here.
I have implemented the following workaround to check for this (what seems to be a) false-positive, but it is definitely a band aid: (pseudo code)
try {
await tablesDB.updateRow({..., data: {my_column: content}})
} catch (error) {
if (error instanceof AppwriteException && error.code === 401) {
const verify = await tablesDB.getRow({..., queries: [Query.select(["my_column"])])
if (verify["my_column"] === content) {
// The intended update worked, despite 401 error response
} else {
throw error // A genuine error
}
} else {
throw error // A genuine error
}
}
As I said, I did not have time to thoroughly investigate this issue to find a minimum example to reproduce this, but I still thought I would share it here, in case you would know what to investigate! We are on a self-hosted instance version 1.8.1.
Do you have relationships in your table?
Yes, there is at least 1 relationship in the table
There is a 2-way-relationship column, but the row on both ends of the relationship indeed have permissions for my user.
But worth mentioning, the update I perform is not on a relationship column
Recommended threads
- Error getting preview of file
Rest Response: ``` { "message": "Server Error", "code": 500, "type": "general_unknown", "version": "1.8.1" } ``` Appwrite Logs ``` appwrite ...
- Flutter SDK broken by cloud.
Today I woke up to find all my flutter amd appwrite projects not working due to the sdk throwing error "Type "String" is not a subtype of "int"". Something chan...
- Database listRows method call failing in...
I'm getting an error when trying to use listRows in a flutter app on a database. It seems something in the backend has changed because the production version of...