Closed jameswillis99 closed 2 years ago
perhaps related #9282
This should be solved as of version 4.3.17 of aws-amplify
. If you can, please give it a try and confirm!
In a sense yes it's been resolved, although possibly not all network errors are triggering the "Network Error" catch as we still have a couple of mutations which get isolated on the client.
Is there anything I can track in relation to the Reachability improvements?
Happy to close this colleague has raised another ticket https://github.com/aws-amplify/amplify-js/issues/9741
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help
channels or Discussions for those types of questions.
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
DataStore
Amplify Categories
storage
Environment information
Describe the bug
Datastore uses navigator.onLine which does a good job of detecting offline but is not reliable enough for detecting when online as it does not always check if it can reach the internet. This causes the app to believe its online (when actually offline) and timeout the jittered mutations before dequeuing the data and being lost from the sync process.
For example our use case is as follows:
A person using a windows go surface tablet (windows 10) will be in an area with very low signal/no signal for up to a whole day. They want to be able to sync their data up if there is signal, but often they can go hours without any internet connection. This issue causes the device sometimes believes it is online and will start attempting mutations which get jitteredretry'd and eventually fail and drop from the outbox. Our data is quite important and losing it is quite a big issue for us
Expected behavior
The app should properly detect if it can reach the endpoint, and not discard data if it has no network connection.
I have had to fork and modify source code locally as our project has a tight deadline, I fixed it by making an API call to the APPSYNC endpoint as well as if the sync mutation fails for network error it will turn app to offline and stop processing more mutations.
I'm happy to put up this PR and take advice to get this fixed. (possibly a websocket would be better than a setinterval which i've used to ping the backend - but unsure how to implement in this project)
Reproduction steps
aws-exports.js
const awsmobile = { "aws_project_region": "eu-west-2", "aws_cognito_identity_pool_id": "eu-west-2:xxxxxxxxxxxxxxxxxxxxx", "aws_cognito_region": "eu-west-2", "aws_user_pools_id": "eu-west-xxxxxxxxxxxxxxxxxxxxx", "aws_user_pools_web_client_id": "xxxxxxxxxxxxxxxxxxxxx", "oauth": {}, "aws_cognito_username_attributes": [ "EMAIL" ], "aws_cognito_social_providers": [], "aws_cognito_signup_attributes": [], "aws_cognito_mfa_configuration": "OFF", "aws_cognito_mfa_types": [], "aws_cognito_password_protection_settings": { "passwordPolicyMinLength": 8, "passwordPolicyCharacters": [ "REQUIRES_LOWERCASE", "REQUIRES_UPPERCASE", "REQUIRES_NUMBERS", "REQUIRES_SYMBOLS" ] }, "aws_cognito_verification_mechanisms": [ "EMAIL" ], "aws_appsync_graphqlEndpoint": "xxxxxxxxxxxxxxxxxxxxx", "aws_appsync_region": "eu-west-2", "aws_appsync_authenticationType": "AMAZON_COGNITO_USER_POOLS", "aws_cloud_logic_custom": [ { "name": "xxxxxxxxxxxxxxxxxxxxx", "endpoint": "xxxxxxxxxxxxxxxxxxxxx", "region": "eu-west-2" } ], "aws_user_files_s3_bucket": "xxxxxxxxxxxxxxxxxxxxx", "aws_user_files_s3_bucket_region": "eu-west-2" };
module.exports = awsmobile;