
Hello, I would like to understand what is wrong with the way I create a document. I have added the right to create and read for any in my collection. I can make a listDocuments but not a createDocument.
Thanks for your help.
TypeScript
async function createDocument(filePath) {
const data = await fs.promises.readFile(filePath, "utf8")
const documents = JSON.parse(data)
for (const document of documents) {
const documentId = document.$id + "-test"
delete document.$id
const response = await databases.createDocument(
databaseId,
collectionId,
sdk.ID.custom(documentId),
document,
)
console.log("Document created: ", response)
}
}
TypeScript
AppwriteException [Error]: The current user is not authorized to perform the requested action.
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.5.4'
}
TL;DR
Developers are facing a "user_unauthorized" issue when trying to create a document despite having proper permissions in the collection. The error message indicates that the current user lacks authorization for the action. This issue occurs when creating a document using the provided JavaScript code.Recommended threads
- 2 Columns still processing since yesterd...
Hey o/ Yesterday (around <t:1758045600:f>), I created a database and added several columns to it. After about 15 minutes, most of the "processing" tags disappe...
- 503 Timeout when Updating or Upserting D...
Hey I’m running into an issue when trying to update or upsert a row in Appwrite. The request hangs for a while and then throws this error: ``` AppwriteException...
- Row with the requested ID already exists...
I’m hitting a blocking issue creating rows in Appwrite (both from the console and my React Native app). After successfully inserting the first row, every subseq...
