-
Notifications
You must be signed in to change notification settings - Fork 199
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 not syncing with AppSync #340
Comments
Meant to include the following config info: amplifyxc.config:
awsconfiguration.json
amplifyconfiguration.json:
Any other setup files that might be useful? |
I've enabled verbose logging and saving a new note called "6" in the DataStore prints the following: Click to expand
|
Firs of all, thank you for creating such a comprehensive issue report. This is really helpful and also motivating to see the dev community diving so deep into our code. Secondly, my immediate recommendation would be to try the latest version of our code directly from the pod 'Amplify', :git => 'https://github.com/aws-amplify/amplify-ios.git'
pod 'AWSPluginsCore', :git => 'https://github.com/aws-amplify/amplify-ios.git'
pod 'AmplifyPlugins/AWSAPIPlugin', :git => 'https://github.com/aws-amplify/amplify-ios.git'
pod 'AmplifyPlugins/AWSDataStorePlugin', :git => 'https://github.com/aws-amplify/amplify-ios.git' |
@drochetti If I'm honest I was just rubber ducking with myself, trying to find where I'd gone wrong. I updated the Podfile to point directly to the master branch as per your suggestion, deleted the Podfile.lock file, installed the pods, cleaned the project, deleted the app from the simulator and then ran it again, but it still appears to not be sending Is it worth me starting from scratch with pods from the master branch in case the setup scripts have changed? Here's the verbose logs from save a note with the content "clean slate 4": Click to expand
|
My issue is possibly related to #265 because I noticed that my Amplify.Datastore.query is not returning objects from the server either. |
|
I was able to reproduce the issue when creating a new app from scratch and I see the following GraphQL errors in the logs:
This seems to be related to this issue aws-amplify/amplify-js#4535 |
Hi @James-Coleman, I was able to identify the problem. This is related to some other issues we're tracking. Basically DataStore sync capabilities only work when your API was created with conflict resolution enabled. That is part of the "Advanced settings" when you run Since you already created your API, you can run
The important setting is when you're asked Do you want to configure advanced settings for the GraphQL API, answer yes and on Configure conflict detection? also pick yes. Now, when you execute your app again, all the local Data you had created before should be synced to the cloud and available to you in the AppSync console. Again, thanks for reporting this, I'm talking to the CLI team in order to improve this flow for all platforms to improve the DataStore setup process. Related PR: aws-amplify/amplify-cli#3495 |
Good news and bad news After running the commands you suggested, I seemed to get a new table in DynamoDB called "AmplifyDataStore" where new Notes created via both API and DataStore are sent as well as my "Note" table. After some time the AmplifyDataStore table seems to get cleared out, but this might be expected? However, I had to downgrade to the published CocoaPod version. In master branch, Notes added via DataStore were still not appearing on the web. Even in the CocoaPod version, Notes added via API are not appearing in DataStore.query. |
Facing exactly the same problem here. Saving and querying from local is fine but data sync on DynamoDB is not working. |
The
Can you clarify what you mean by "In master branch, Notes added via DataStore were still not appearing on the web"? When you say Web do you mean the DynamoDB Web Console? |
The AmplifyDataStore table is a sign that the DataStore SyncEngine is working
that's the expected behavior
Good to hear.
When you say Web do you mean the DynamoDB Web Console?
Yes, exactly.
…On Mon, 2 Mar 2020 at 19:09, Daniel Rochetti ***@***.***> wrote:
@drochetti <https://github.com/drochetti>
Good news and bad news
After running the commands you suggested, I seemed to get a new table in
DynamoDB called "AmplifyDataStore" where new Notes created via both API and
DataStore are sent as well as my "Note" table. After some time the
AmplifyDataStore table seems to get cleared out, but this might be expected?
The AmplifyDataStore table is a sign that the DataStore SyncEngine is
working. That table is managed by AWS AppSync to deal with changes across
different instances of your application (i.e. different users on iOS, or an
user on iOS and another user on JS). Therefore, you don't have to worry
about it getting cleared, that's the expected behavior.
However, I had to downgrade to the published CocoaPod version. In master
branch, Notes added via DataStore were still not appearing on the web.
Even in the CocoaPod version, Notes added via API are not appearing in
DataStore.query.
Can you clarify what you mean by *"In master branch, Notes added via
DataStore were still not appearing on the web"*? When you say Web do you
mean the DynamoDB Web Console?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#340>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADNJ53TX2OQAJWEVUBAUQIDRFP75HANCNFSM4K47D4MQ>
.
|
@James-Coleman and @jackatkoeln So, even after enabling the conflict resolution on the API you're still not getting the local persisted models synced to your DynamoDB. Did you see error messages like the ones I posted here #340 (comment) in your logs? |
I'm in a similar boat. Having worked my way through the documentation I'm experiencing similar issues. Adding objects or even just querying objects gives :
This is after pointing at master as well as enabling conflict resolution. (I'm also seeing the DynamoDB called "AmplifyDataStore") |
I'm seeing Note objects added via both This is with the CocoaPods version (0.10.0). As mentioned above, the master branch wasn't working for me earlier but I'll try again. After creating a Note called "new via api" and uploading via Click to expand
After creating a Note called "new via datastore" and saving with Click to expand
|
Am facing the same issue with RN, datastore is not synchronized with dynamodb. i can query, update, save to the local store. but nothing is updated on dynamodb. conflict resolution is configured correctly and tables have all versioning fields. |
The doc suggests a different workflow : https://aws-amplify.github.io/docs/ios/datastore#datastore which does not suppose to use the Can we keep the doc updated with current status of the workflow ? |
Hi All,
With this I am able to run the app on two (or more) devices and see real time data store updates whilst the app is open on the devices. However I have an issue when the app is closed (force closed), starting with the app running concurrently on 3 devices (2 simulators and 1 iPhone 11 Pro) I force close on 1 device and then create a new 'booking' in my case. This is then saved, synced and appears on the 2 device will the app still open. After this I open the app on the third device which then takes several hours to sync data store with AppSync. I'm at a loss to how to make the sync happen when the app is either brought back from the background or opened from fresh again. Any advice would be greatly appreciated. FYI: I tried pulling the pods directly from the repo, however this now causes the API subscription to fail to connect. |
I've had this issue as well (in React Native) TDLR: It seems like DataStore and API.graphql(graphqlOperation... are writing and reading to two different targets. When I write to DataStore, it doesn't show up in DynamoDB. When I write using API.graphql, it doesn't show up when I query with DataStore. Very odd and frustrating. Can answer questions if needed. EDIT: |
I am seeing this issue with web application as well... |
I'm seeing this same problem too. DataStore and API.graphql don't see the same data, and DataStore doesn't persist to DynamoDB or the backend at all, but stays on the client even after a config change. |
I was having the same issue, but this seems to have fixed my issue. Any update improving the flow? Or at least defaulting the conflict resolution so this option doesn't need to be configured out of the box? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@Johnniexson, @ivenxu, @shravanjha, @small4all Could you open your issues on the https://github.com/aws-amplify/amplify-js/issues repo ? This issues page is specifically for iOS, and we won't be able to provide any useful guidance for you. |
Hey @James-Coleman we just released a stable v1.0.0. Could you try following the new DataStore tutorial and see if the new flow and stable code fixes your issues? I appreciate your patience and the fact you tried our unstable preview and provided valuable feedback and insights with your issue report. I hope the stable release fixes things for you. We also have a brand new Discord server for Amplify related topics. Feel free to hit me up there to talk about your use cases and challenges with the new APIs and docs. https://discord.gg/amplify |
I had similar problem, AWS DataStore was not syncing data to Cloud when I followed new DataStore tutorial. But at one time I tried write |
Could you please share your transform.conf.json. I am also facing the same issue. |
My transform.cong.json:
} |
@vitzaoral thanks for the confirmation. I'm closing this issue for now. Feel free to open a new one if you have problems with the stable version of Amplify. |
@drochetti - I'm seeing the same in my local environment. When I write data with API.graphQL --> saves to Dynamo, no problem. I have attempted the amplify api update flow --> still doesn't help/work. "@aws-amplify/cli": "^4.49.0" |
I am following Tutorial ... everything works except sync.
|
How do you enable verbose logging as shown in this comment? I am stuck with a similar problem after switching the @auth mode from public to owner |
@charlieforward9 |
I am using Flutter and cannot get this to work. Is there an import I need to make? |
I've been following along the "Hello world" style notes tutorial for api and datastore.
API and DataStore seem to be working great independently but DataStore saves are not being pushed to the server. Ricardo on Twitter suggested I make this issue.
I'm adding a note with:
This succeeds, but I do not see the note in my DynamoDB, which I expected to.
Adding a new note via the API works fine:
These are the notes created via Amplify.API:
And these appear in the database:
But the notes created with Amplify.DataStore.save are not there, but can still be queried locally:
I've found the
AWSDataStorePlugin.isSyncEnabled
and this is getting configured to true:This is then passed to StorageEngine:
Which creates a RemoteSyncEngine:
Saving a Note successfully calls StorageEngine.syncMutation:
Which in turn successfully calls submitToSyncEngine:
This successfully goes through to:
RemoteSyncEngine.submit
AWSMutationDatabaseAdapter.submit
AWSMutationDatabaseAdapter.resolveConflictsThenSave
MutationEvent.pendingMutationEvents completes with a success.
This enters AWSMutationDatabaseAdapter.resolve with a disposition of
.saveCandidate
This enters AWSMutationDatabaseAdapter.save which calls SQLiteStorageEngineAdapter.save which succeeds.
I don't have logging installed at the moment but that's the next thing I'm going to do to see if it reveals the problem.
Installed via Cocoapods:
Exact versions:
Xcode 11.3.1
Swift 5.1
This has been tested on simulators running iOS 13.3 and a real device running 13.3.1
The text was updated successfully, but these errors were encountered: