You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DataStore bug: If a newly-created item fails to get synced on the first try because of a network error, it never gets synced properly after that.
#9741
Creating items in DataStore fails if there is bad connectivity. When it comes to the availability of the internet connection, there are 3 main scenarios:
completely offline - DataStore works correctly
online with good connection - DataStore works correctly
online with spotty/slow/high-latency connection - the issue manifests itself
In short, if a "create" mutation has already started processing and then it fails for a network-related reason and then the internet connection goes offline altogether, when the connection returns, there is an Unrecoverable DataStore error message from DataStore with a ConditionalCheckFailedException coming from DynamoDB. At this point, the mutation is removed from the queue and it never gets retried, which means that item is never going to be properly synchronised.
I've looked in DynamoDB and the item does get created, which explains the ConditionalCheckFailedException we get back.
Expected behavior
If there is spotty connectivity, I expect that when good connectivity is re-established, DataStore would perform a sync that lets it know the item has actually been successfully synchronised, which should make it update its local database with the correct state.
Reproduction steps
Create a high-latency network profile in Google Chrome and switch to it
Trigger a "create" mutation from the front-end.
After a few seconds, switch to the "Offline" network profile in Google Chrome.
Again after a few seconds, switch to the "No throttling" network profile in Google Chrome.
There is now an Unrecoverable DataStore error message from DataStore with a ConditionalCheckFailedException coming from DynamoDB.
The newly-created item doesn't gets a value set for its updatedAt field.
Code Snippet
// Put your code below this line.
Log output
No response
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered:
@david-mcafee I already have that change and unfortunately it doesn't fix it. I've even tried to make a fork of the DataStore repo to completely remove code that dequeues items and all that resulted in was DataStore kept retrying the item forever, with DynamoDB returning the same error.
I've just realised that the "Unrecoverable DataStore error" message is a log I had added to my own code, but that doesn't change the underlying issue. Just putting this here because it's probably confusing to see that error message in the issue description, since the wording isn't actually coming from within DataStore itself.
Hi @dragosiordachioaia and @jameswillis99 👋 We haven't been able to reproduce this issue with the reproduction steps given on the latest version of aws-amplify. Going to close this as stale, but if you are experiencing this issue please let us know or provide any additional context/info you might've gathered since. We can re-open this issue once we have more information.
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
DataStore
Amplify Categories
auth, api
Environment information
Describe the bug
Creating items in DataStore fails if there is bad connectivity. When it comes to the availability of the internet connection, there are 3 main scenarios:
In short, if a "create" mutation has already started processing and then it fails for a network-related reason and then the internet connection goes offline altogether, when the connection returns, there is an
Unrecoverable DataStore error
message from DataStore with aConditionalCheckFailedException
coming from DynamoDB. At this point, the mutation is removed from the queue and it never gets retried, which means that item is never going to be properly synchronised.I've looked in DynamoDB and the item does get created, which explains the
ConditionalCheckFailedException
we get back.Expected behavior
If there is spotty connectivity, I expect that when good connectivity is re-established, DataStore would perform a sync that lets it know the item has actually been successfully synchronised, which should make it update its local database with the correct state.
Reproduction steps
Unrecoverable DataStore error
message from DataStore with aConditionalCheckFailedException
coming from DynamoDB.updatedAt
field.Code Snippet
// Put your code below this line.
Log output
No response
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: