Issue: Getting 401 Unauthorized Error When Creating Row with Relationship Despite Having Full User P
- 0
- Databases
- Auth
- Web
- Cloud
Hi team,
I'm encountering a 401 user_unauthorized error when trying to create a row in my projects table, even though I have full user permissions configured for both related tables.
Error Details:
{
"code": 401,
"type": "user_unauthorized",
"response": "{\"message\":\"The current user is not authorized to perform the requested action.\",\"code\":401,\"type\":\"user_unauthorized\",\"version\":\"1.8.0\"}"
}
Code:
await tablesDb.createRow({
databaseId: APPWRITE_DB_ID,
tableId: DB_PROJECTS,
rowId: ID.unique(),
data: {
projectName,
projectType,
projectDescription,
projectPriority,
projectStatus,
company, // This is a relationship field (Many-to-One with companies table)
startDate: finalStartDate,
dueDate,
assignedTo: [${user.$id}],
tags,
requestedAmountHuf,
approvedAmountHuf,
progressPercentage: 0,
createdBy: user.$id,
},
permissions: [Permission.read(Role.user(user.$id))],
})
Setup: Relationship: projects → companies (Many-to-One) Permissions: Both projects and companies tables have full user access configured Authentication: User is properly authenticated (using node-appwrite SDK)
What I've tried:
Verified user permissions on both tables Confirmed the relationship is properly configured Checked that the company value being passed is a valid document ID
Is there a specific permission requirement for creating rows with relationships that I might be missing? Or could this be related to how relationship permissions are inherited? Thanks for any guidance!
Recommended threads
- Project Paused Despite Daily Active Usag...
I noticed that my project was automatically **paused**, even though it is actively being used. The project is an **attendance application** that is used daily b...
- Hi Appwrite Support Team,My project has ...
Details: Project ID: 69a69f6f00113ed0e8e4 Region: SFO (sfo.cloud.appwrite.io) Error Response: Affected: ALL endpoints — Functions, Databases, Storage, Health, ...
- Sudden CORS Errors - Domain hasn't Chang...
I have an Appwrite project with two web apps configured, the first one has the hostname `*` and the second one I just added to test if it could fix the issue wi...