-
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
AWS Amplify DataStore does not update properly #12916
Comments
Hello, @koreahn and sorry to hear you're experiencing this. Have a couple of questions and requests to see if we can help unblock you. It looks like you're using v5.X of Amplify, so are you able to add logging to your app via the Console Logger? This will allow us to turn the logging level to Outside of this, can you clarify if you are using auto-merge or OCC for conflict resolution? Thanks! |
Hello. Thank you for your reply.
Belows are the logs. It's same as before. And the log of the catch clause was not printed.
I am very new to using Amplify. Did I apply the logs properly? Let me know if you need anything else. |
Hi @koreahn, Auto Merge and OCC (Optimistic Concurrency) are conflict resolution strategies you can use with DataStore enabled. For more info on how they work and differ in behavior please refer to the AppSync documentation: I think what @cwomack was referring to is adding this to your app where you are configuring Amplify. Amplify.Logger.LOG_LEVEL = 'DEBUG' This will log all of the Amplify events for all categories |
Thank you @chrisbonifacio. @cwomack |
Can you help me? What should I do? |
@koreahn what conflict resolution strategy are you using? Custom Lambda? |
Hi @koreahn following up here - have you had a chance to see the comment from @chrisbonifacio above? |
Hello @chrisbonifacio, @nadetastic. I am very new to Amplify, so I don't know what the conflict resolution strategy is. How can I check it? |
Thanks for the replies on this, @koreahn. It sounds like you could be using AutoMerge as the default conflict resolution strategy if you haven't made any changes yourself. Could you share your schema and possibly the code that's running queries of the object for the second device? Also, are you using the SQLite adapter? Any further reproduction steps or clarity on differences for each device (i.e. code they are running, if they are being opened at same time, etc.) would be helpful as well! Thanks. |
Thank you very much @cwomack. I have not made any changes.
And below is query of the object.
I dont use SQLite adapter. I have conducted tests using multiple versions of iOS and Android simulators, as well as physical Android devices. However, I have encountered inconsistency in updates, experiencing cases where updates occur on the same device while other times they do not. I haven't been able to identify any specific rules governing this behavior. I am not sure if I am answering correctly or not. If these are not correct answer, could you provide more specific details about what tasks I can handle please? |
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
DataStore
Amplify Version
v5
Amplify Categories
Not applicable
Backend
Amplify CLI
Environment information
Describe the bug
I want to save the user token to DB(DynamoDB), so I checked and saved in App.js.
During testing, I noticed that the token often doesn't update. So I tested the token alternately to two different simulators.
Belows are my code.
Belows are logs.
LOG Entering updateDeviceToken
LOG deviceToken is present
LOG auth tokenaaaaa <<<<<<<<<< phisical device token.
LOG dbUser.token tokenbbbbb <<<<<<<<<< saved token in DynamoDB earlier
LOG dbUser.id 73e114d0-6c73-40d0-9b18-c015ae9edd8d
LOG user1 {....."token": "tokenbbbbb",.....}
LOG user2 {....."token": "tokenaaaaa",.....}
On the log, the update appears to be normal. But when I check the actual data on the amplify console, it doesn't update and still shows 'tokenbbbbb'.
And sometimes there is also a problem with the 'User' table query. The 'User' table has not updated token to tokenbbbbb, but when I run the program again and query the 'User' table, it is inquired to tokenbbbbbbbb. (Actual DB shows tokenaaaa in Amplify console).
Several tables have been created and are being used, but this problem only occurs in the 'User' table.
Expected behavior
The token of the physical device shall be updated to DynamoDB
Reproduction steps
Code Snippet
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: