
I have this barebones POST endpoint on Next JS.:
export async function POST(req:Request){
try {
const conversation = await req.json() as INewConversation;
const {database,config} = await createSessionClient();
const conv = await database.createDocument(config.databaseId,
config.conversationCollectionId,
ID.unique(),
conversation
);
return NextResponse.json(conv as unknown as IConversation);
}catch (error) {
return new NextResponse(`Internal Error - ${error}`, { status: 500 }) }
}
Now, the conversation table has the attributes in attached image. It has relationships to the user and messages tables.
Permissions I made sure to tick them all for "Any role" for the main table and the relationship tabled.
How come I am still getting the below error on document creation:
"AppwriteException: The current user is not authorized to perform the requested action."
This seems like a very stupid mistake from my end but I have other tables which are working fine and this one just won't work. I am able to create entries from the GUI as an admin.
Appwrite docker log:
2024-05-28T17:36:56.829015933Z [Error] Timestamp: 2024-05-28T17:36:56+00:00
2024-05-28T17:36:56.829061804Z [Error] Method: POST
2024-05-28T17:36:56.829069100Z [Error] URL: /v1/databases/:databaseId/collections/:collectionId/documents
2024-05-28T17:36:56.829073822Z [Error] Type: Appwrite\Extend\Exception
2024-05-28T17:36:56.829079045Z [Error] Message: The current user is not authorized to perform the requested action.
2024-05-28T17:36:56.829083896Z [Error] File: /usr/src/code/app/controllers/api/databases.php
2024-05-28T17:36:56.829088082Z [Error] Line: 2839
Recommended threads
- Billing issue
Hey, i recently Purchased the Pro Plan on Appwrite but I've changed my mind id there any way i xould cancel the Pro use the Free Tier and get my refund?
- I can't update my email templates in sel...
I have attached a long screenshot of the whole page to provide a better context to the issue I am having. The summary is that on navigating to the Auth templat...
- Creating a relationship with nested obje...
{ "data": { "name": "DiDi", "type": "Software Development", "userJobs": [{ "$id": "68cbf1e2003612fb13ca", "j...
