-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 synchronization issues with DataStore under poor network conditions #13127
Comments
@chrisbonifacio @cwomack, I am tagging you as discussed in yesterday's 'Office Hours' |
@schutzelaars, appreciate you creating this issue from the Discord Office Hours discussion! Just to clarify one detail, how much do you throttle the network (i.e. slow/fast 3G or another speed) before you experience this issue? And is it reproducible every time or somewhat inconsistent? Finally, any frontend code that seems to be associated with this would be helpful to see if you can share it. Thanks! |
@cwomack Yesterday, I reproduced the issue 5 out of 5 times using slow 3G speed. The code is fairly standard. I've updated the issue with some code examples, though I'm not sure if they will be helpful. The only changes to this code were syntax updates when we migrated from Amplify v4 to v6. |
@cwomack Can I do anything to speed things up? Alternatively, could you direct me towards potential solutions or methods to more accurately identify the problem's cause? It's currently affecting a number of our customers. |
Hi @schutzelaars Thank you for providing repro steps. We will try to reproduce the issue internally and get back to you with an update once we identify the root cause and/or have a solution. |
@chrisbonifacio Today, I was able to reproduce it with an "update" mutation; the same problem/error occurs. |
@chrisbonifacio @cwomack I forgot to mention that you can extend the error window by throttling the CPU speed (for example, a 6x slowdown). This makes it easier to reproduce Step 3. Hope this helps! |
Has anyone been able to reproduce the issue? |
Before opening, please confirm:
JavaScript Framework
Vue
Amplify APIs
DataStore
Amplify Version
v6
Amplify Categories
auth, api, hosting
Backend
Amplify CLI
Environment information
Describe the bug
After upgrading Amplify from version 4 to version 6, we encounter synchronization issues with DataStore under poor network conditions. Currently, this issue impacts some of our customers with very poor internet connections, which is why we chose to use DataStore. This issue did not occur when we used version 4 a couple of weeks ago.
The problem manifests when creating a local documents during network instability—simulated by throttling network speed, and switching to offline mode while the document is saved in DataStore. At this point the newly created document is succesfully inserted in IndexedDB.
The issue arises when a DataStore error is caught by the "errorHandler" in the DataStoreConfig:
{ operation: "Create", process: "mutate", remoteModel: null }
Cause:
{ name: "GraphQLError", message: "Network error" }
Despite succesfull local document creation, DataStore fails to synchronize these documents once the network stabilizes, or when calling DataStore methods stop/start. The "OutboxStatusEvent" contains
isEmpty: true
, and the document is never inoutboxMutationEvent
andoutboxMutationEvent
event data.I plan to conduct further testing later to determine if this issue also occurs with update mutations. Additionally, I'll see if updating the created document, which fails to sync, yields any result.
EDIT:
The same error occurs when updating a document
{ operation: "Update", process: "mutate", remoteModel: null }
, with the same cause.Possibly related issues: #4131 #13035
Expected behavior
DataStore/IndexedDB documents that are successfully saved with
_version: undefined
should synchronize when the internet connection is good. And be found inoutboxMutationEvent
andoutboxMutationEvent
event data.Reproduction steps
EDIT:
To make Step 3 easier to reproduce, extend the error window by throttling the CPU speed (for example, a 6x slowdown).
The screenshot added of warning is the error that would be caught by the "errorHandler" in the DataStoreConfig
Code Snippet
Log output
aws-exports.js
The text was updated successfully, but these errors were encountered: