Open duckbytes opened 10 months ago
I had another report from a user today, they were the first one to test out the native version on iOS. The said they had to go back to using the web version, because their tasks were just not appearing for them.
Some possibly related issues: https://github.com/aws-amplify/amplify-flutter/issues/3865 https://github.com/aws-amplify/amplify-js/issues/11708
Hey, @duckbytes 👋. We're looking into this and related issues (like you've referenced above). Greatly appreciate the details and context you put into the issues you open, especially when they are difficult to reproduce like this one! If there's any further questions or progress, we'll update this issue as soon as we can.
@cwomack Do you have any more information about this or especially the related issue (https://github.com/aws-amplify/amplify-flutter/issues/3865) ? I am trying to get some information and there has been no updates in a month.
Is this being prioritized? For our app the effect of the related issue is severe.
It was suggested to me that this issue might be related https://github.com/aws-amplify/amplify-category-api/issues/1853
Apparently it was fixed in the most recent version of the amplify cli.
I'm going to try and push an update this week and ask users for feedback.
If you're here from Google trying to solve this, you might have created the app with an old version of Amplify. Check the AmplifyDataStore table on DynamoDB, and make sure that the PartitionKey and SortKey are both "ds_pk" and "ds_sk" respectively.
Specifically you should be getting a "DeltaSyncWriteError" or "Failed to write Delta Sync Record" error.
For some reason, on my version it was set to "pk" and "sk" even though it was created by the CLI. Manually deleting and then recreating the table resolved the issue for me.
It looks like all my tables have ds_pk and ds_sk, although they were created with an old version (11.0.3).
What's interesting is I don't think I've ever seen any entries in those tables, except for today I suddenly noticed there were a few items in just one of them (I have multiple DataStore tables to serve different tenants). The other ones (including the tenant who are most active) are empty.
I'm updating the backend today with the latest version of Amplify, so I'm going to observe and see if anything starts appearing in those tables.
EDIT: Few hours later and I'm already seeing new entries in that table now. Though that doesn't mean for sure they weren't appearing before! Just the first time I've ever looked and it wasn't empty.
Per my understanding, there is a TTL on the delta sync table. They're removed automatically after a period of time.
If there are entries that does imply that it is syncing.
It did take me awhile, but Amplify.Logger.LOG_LEVEL = 'DEBUG';
as well as enabling Cloudwatch Logging on the Amplify API was incredibly helpful in helping me finally figuring out what was happening.
Several of my users are still reporting a lot of issues with this. Apparently they have to log out and log in several times during their shift to receive updates from other users. This is happening with both the web version and mobile version. I've found it very hard to re-create at home so I don't know what is going on.
Are there any thoughts or advice on what I can do to try and figure this out? Any logs that might have a hint?
I should probably try to capture logs created on the devices themselves as well. Not sure if there is a good way to do this with Amplify or if I should look for another way.
I had a conversation with a user working with another tenant who cover a different geographical area.
They say they've had no problems at all. They do have a smaller call volume, so less data needs to be synced. They also cover a smaller and less rural area.
This makes me think of three possibilities:
It's possible that the user experience goes something like this:
I'll try and communicate to the users and figure out if this is the case.
Before opening, please confirm:
JavaScript Framework
React, React Native
Amplify APIs
Authentication, GraphQL API, DataStore
Amplify Categories
auth, api
Environment information
Describe the bug
We have been using an app developed with both React and React Native. It uses DataStore to do the majority of communications with the API.
I've had several reports from users along these lines:
Incoming data does not sync, or takes a very long time (sometimes hours) to sync and appear on their devices.
Outgoing data does not sync, until the user logs out and logs back in again. Logging out clears the datastore. This means that their unsynced data is lost and they have to re-enter it. Then sync starts to work again.
There are the two most relevant models in my schema:
This is the entire schema: https://github.com/platelet-app/platelet/blob/master/amplify/backend/api/platelet/schema.graphql
The TaskAssignee record is created to assign a user to a Task. This is the model that the dashboard subscribes to with
DataStore.observeQuery
to show their tasks to the user, and could be why it takes a long time for incoming data to appear.The Task record is what gets updated when the user updates their tasks through the dashboard. It is linked to the TaskAssignees model.
In the past I've experienced an issue with
DataStore.observeQuery
not working properly when{allow: private, operations: [read]},
is used instead of{allow: groups, groups: ["USER"], operations: [read]},
. I would find that data did not appear if it was created by another user when the model also hadowner
auth. I'm not sure that this is related or not, but I could try using the groups auth instead of private auth on my other models. It'll just need to be tested before going into production, where the issues are happening.There are two versions of Amplify being used, on the web version it uses
^4.3.46
and on the mobile^5.3.11
. I can't update the web version yet because of breaking changes. All records are created on the web version. The mobile version only reads and updates data. However I get similar reports from users using the web version for the same purposes as the mobile version (for updating Tasks while out and about).I have x-ray set up and have looked through logs during times I know users have had issues, but nothing stands out. Every log entry says "OK". If I know what I need to be looking for I might be able to find some more useful information.
Expected behavior
I expect DataStore to always sync incoming and outgoing data.
Reproduction steps
It's difficult to specify steps for a basic reproduction. If it's helpful to, the project can be built and deployed from https://github.com/platelet-app/platelet and the mobile version is here: https://github.com/platelet-app/platelet-mobile
More or less it is an Amplify project with DataStore enabled and optimistic concurrency, using cognito for auth with user groups.
Code Snippet
I use this hook to synchronise data on my dashboard. It can be explored better here https://github.com/platelet-app/platelet/blob/master/src/hooks/useTasksColumnTasks.ts
The same hook for populating the dashboard on the mobile version. This one is a bit simpler and cleaner than the web one.
This is the component on mobile for updating tasks. It's very similar on the web version and can be looked at in more detail here: https://github.com/platelet-app/platelet/blob/mobile/mobile/src/screens/Task/components/TaskActions.tsx
And this is my conflict handler, which I don't know if could be a cause for issues:
Log output
aws-exports.js
This is just an example from my dev aws-exports.
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
Android, iOS of various versions
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response