-
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 sync processor rety error - about every 24 hours #12954
Comments
Hello, @alex-breen 👋 and sorry to hear you're running into this. It sounds like this could possibly be related to when DataStore is trying to re-establish the connection, but the tokens for a given user are potentially expired. Can you look into what you've configured for the expiration timeframe for your refresh and access tokens to? Does this happen in a production version of the app as well or just locally when in dev mode? |
Hi @cwomack - My cognito settings are:
Does this happen in prod? Yes, I'm pretty sure at least. I'm sure I've seen the browser log errors, and pretty sure I've seen the red error overlay over the screen, but I'll watch for that to be sure. <<Update: Happens in prod, but overlay with red messages doesn't appear on browser in prod, only console errors. In dev, overlay with red errors appears.>> |
Update: On production, I've encountered the issue twice (about every 24 hours). The console logs show the errors:
But the browser screen doesn't get the overlay with red error messages. On the dev build, it does. |
Another update (reproduction is slow because it seems to occur after several hours of sleep or inactivity):
@cwomack is there something I can do to catch this when it happens and restart Datastore? |
Do you recommend I call Note, I can't call |
@alex-breen As a potential path to a workaround while the repro of this is pending, do any of the auth events indicate the need for a Datastore restart? https://docs.amplify.aws/react/build-a-backend/auth/auth-events/#listen-to-and-log-auth-events |
@svidgen - I don't think so, as no error events are passed. Datastore events indicate everything is working (syncQueriesReady) and Auth is fine. |
@cwomack - I've tried cycling a stop and start of |
To reproduce (artificially):
|
Hi @alex-breen, thank you for the repro steps. Unfortunately, I have not been able to reproduce this issue with the provided steps. These were the events logged from the Hub during my reproduction. In my case I might've run into a different issue - I never got another I also observed that updating a record from another browser instance was reflected. The highlighted record was updated from a second, incognito window. I am only able to get the Are you sure that those steps are in the correct order? |
Hi @chrisbonifacio - I've jotted down a few things that might help shed some light:
|
@chrisbonifacio - by any chance is there an update on this? Even with my hacky workaround, I've seen Safari fail (silently), leading to data loss on an add request (amplify js doesn't throw an error, but sync fails to write, but app doesn't know this, so data is lost). At the very least, just a way to listen for when sync is broken so that I can force a reload would help. |
@chrisbonifacio @cwomack - I've reproduced this with a very simple app that mostly uses the example code in Amplify documentation. Behavior: Wake up computer after sleep. The last refresh of the webpage should be over 12 hours ago. Update data from a separate computer (or incognito browser). Result - The update does not appear on the primary browser. Data is now out of sync. Hub events report "syncQueriesReady" but websocket messages are not received. I've attached screenshots of the console and network errors that appear right after wake up. I've also attached the relevant code. It's important that authentication is enabled and model schema has |
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
Authentication, DataStore
Amplify Version
v6
Amplify Categories
auth, api
Backend
None
Environment information
Describe the bug
When waking up computer from sleep state, website throws a series of errors (uncaught, over website screen).
Everything resolves by itself but the user sees the browser error modal and has to close it.
I don't have a clear way to reproduce this, but my hunch is that it occurs after the 24 hour "base query" sync from Datastore. I could be seeing a pattern that is not real, but it does seem to occur about once a day, after there has been some idle time (like computer at sleep). I pretty sure this started appearing after I upgraded to v6.
Here is the screenshot of from the browser's console logs.
Here is the screen shot from the browser's network logs:
Browser window screenshot with errors:
Expected behavior
no errors
Reproduction steps
Wake up computer from sleep.
Code Snippet
// Put your code below this line.
Log output
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: