Document Update Success in Cloud Function Logs but Not Reflected in Database
- 1
- Self Hosted
- Functions
Hello Appwrite Support Team,
I hope this message finds you well. I've encountered an issue related to updating a document in my Appwrite database via a cloud function.
I am currently using Appwrite version 0.12.4.202. I am attempting to update a document using a cloud function. Post-update, within the same function, I'm fetching the document from the database and printing the changed value to ensure the changes have been applied. According to the cloud function logs, this change appears to have been executed successfully, every time. However, when I inspect the document directly in the Appwrite console, the expected changes do not always happen.
While the change is consistent in the cloud function logs, it's reflected in the actual database only about 3/4th of the time. Interestingly, this inconsistency occurs even when the exact same user performs the actions in an identical manner.
This intermittent nature of the issue is puzzling, and I'm trying to understand the root cause. Please help me. Thank you.
bump
First, if can it's much recommend the upgrade to latest version (remember to upgrade and know the migration increment process)
As for your use-case How do you know that the transaction was indeed success, can you share the function code?
`db = Database(client); storage = Storage(client); Order order = Order.fromJson((await db.getDocument( collectionId: orderCollectionID, documentId: orderId)) .data);
order.status = 'COMPLETED';
await db.updateDocument( collectionId: orderCollectionID, documentId: order.id!, data: order.toJson()); print('Order Status Updated!'); Order orderVer = Order.fromJson((await db.getDocument( collectionId: orderCollectionID, documentId: orderId)) .data); print("ORDER STATUS CHECK: " + orderVer.status);`
and the function logs say:
Order Status Updated!
ORDER STATUS CHECK: COMPLETED
Meaning that it is updated, but somehow "reverts back"? I don't get it. Note that it works sometimes and does not sometimes
What langauge it is?
FYI, it's best to wrap code in backticks to format a bit nicer. You can use 1 backtick for inline code (https://www.markdownguide.org/basic-syntax/#code) and 3 backticks for multiline code (https://www.markdownguide.org/extended-syntax/#syntax-highlighting.
Dart
are there audit logs for the document? it might be in the appwrite console, in the document...maybe one of the tabs
Recommended threads
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...
- Send Email Verification With REST
I am using REST to create a user on the server side after receiving form data from the client. After the account is successfully created i wanted to send the v...
- Use different email hosts for different ...
Hello, I have 2 projects and i want to be able to set up email templates in the projects. Both projects will have different email host configurations. I see ...