-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataStore synch problem during offline item saving #1199
Comments
Hi @target33, what you are describing does sound like a bug! To help debug further, could you:
|
Hi @richardmcclellan, I attached the logs. Prerequisites: I removed manually all items previously saved in DynamoDB and performed a Amplify.DataStore.clear() to make sure no items are present both locally and remotely and the situation was the same of a brand new DataStore tutorial. Then I started to perform the steps as indicated: "logcat - end of step 2.txt" has been taken at the end of step 2 after a Query to check Item 1 save (online mode). If now I check the AWS AppSync Console for the following Query:
This is the result:
No trace of Item 2. Same result by checking inside DynamoDB. The code inside the MainActivity is the following (from the tutorial):
The commented lines in the middle have been uncommented during the 3 steps in order to save the 3 Items. Let me know if you need more information. logcat - after step 8 - query without any item saving.txt |
Thanks for providing those logs! Near the end of
For some reason, the first request (presumably your Item 2) has null values for I'll continue to investigate and try to reproduce. |
Hi,
But why the request to AppSync has null properties for 'name' and 'description' ? I mean, the local version has a name and description assigned correctly (and those are the only data we can handle and work with). I think something goes wrong internally during 'Amplify.DataStore.save' in offline condition. Let me know if you are able to reproduce with the steps described (btw I think this is easily reproducible as a tech friend of mine told me he has the same issue). |
Hi @target33, I can reproduce this bug, and am working on a fix. |
Hi, this issue is related to #823 which has been closed, but actually is still a problem and is easy to recreate by using the main Android tutorial.
The problem occurs while saving an item during an offline condition, stop the program for any reason and start the program again: this way the local and remote items have a mismatch.
I'm using the latest version of Amplify Framework (1.16.13).
My environment:
The scenario related to #823 is neither A nor B: if you apply scenario B everything works, BUT, if you stop the program after each save, the issue is there (local data and cloud data mismatch).
So the steps to recreate the issue are:
onCreate()
method.Amplify.DataStore.query()
): check the local Item 1 is there.The Item 1 is correctly stored both locally and remotely.
Right now we expect that during step 8, the framework will save remotely both Item 2 (which was not saved in step 5 due to the lack of mobile connection) and Item 3, but only Item 3 is saved. If you query locally you'll get all three items. If you query remotely (DynamoDB and AppSync console) you get only Item 1 and 3, Item 2 is lost forever, no matter how many connections or DataStore API calls you make. If you do an
Amplify.DataStore.clear()
after that, Item 2 is gone forever.This is definitely something the Framework should handle.
Let me know if you need more info to recreate the issue.
The text was updated successfully, but these errors were encountered: