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
- router_deployment_not_found
I updated my function a few times and now i am getting the error: router_deployment_not_found I even reverted back to my original code but i am still getting th...
- Usage of the new Client() and dealing wi...
Hey guys, just a quick one - we had some web traffic the other day and it ended up bombing out - To put in perspective of how the app works, we have a Nuxt Ap...
- [Beginner] CLI --queries Syntax Error & ...
Hi everyone! I am a beginner with Appwrite and trying to use the CLI, but I'm stuck with a syntax error. Any guidance would be greatly appreciated! 🙏 **Enviro...