
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
- Insights🐛 Bug Report: Missing Tables AP...
Hi. First time appwrite user. i'm building a new mobile app with react-native & expo and decided to use appwrite as a tech for this app. i found the react-nativ...
- Dockerizing Appwrite Console Yields Page...
I have this Docker Compose file: ``` services: # Band9Buddy app band9buddy: build: context: . dockerfile: Dockerfile.dev develop: ...
- Upgrading Appwrite 1.7.4 → 1.8.x: What H...
I'm currently running a self-hosted Appwrite v1.7.4 instance that still uses the old Collections/Documents database model. I noticed that starting from v1.8.x,...
