Skip to content
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

Cannot sync with the cloud #821

Closed
otabek1 opened this issue Aug 20, 2021 · 10 comments
Closed

Cannot sync with the cloud #821

otabek1 opened this issue Aug 20, 2021 · 10 comments
Labels
datastore Issues related to the DataStore Category pending-close-response-required The issue will be closed if details necessary to reproduce the issue are not provided within 7 days.

Comments

@otabek1
Copy link

otabek1 commented Aug 20, 2021

Describe the bug
I am using Amplify DataStore and API to save to on the cloud. But I am getting "Failed to load class "org.slf4j.impl.StaticLoggerBinder" error when I try to save an object. I followed the same tutorials from the documentation and Youtube.
To Reproduce
Steps to reproduce the behavior:

  1. Create data model and deploy.
  2. Try to save it on the cloud with API

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots

Platform
Amplify Flutter current supports iOS and Android. This issue is reproducible in (check all that apply):
[x] Android
[] iOS

My code: ``` @OverRide void initState() { super.initState(); firstNameController = TextEditingController(); lastNameController = TextEditingController();
_configureAmplify();

}

void _configureAmplify() async {
AmplifyDataStore datastorePlugin =
AmplifyDataStore(modelProvider: ModelProvider.instance);

final AmplifyAPI _apiPlugin = AmplifyAPI();

await Amplify.addPlugins(
    [datastorePlugin, _apiPlugin, AmplifyAuthCognito()]);

// Once Plugins are added, configure Amplify
// Note: Amplify can only be configured once.
try {
  await Amplify.configure(amplifyconfig);
} on AmplifyAlreadyConfiguredException {
  print(
      "Tried to reconfigure Amplify; this can occur when your app restarts on Android.");
}
print("configured");

}

void addAdult() async {
if (formKey.currentState!.validate()) {
print("validated");
try {
final item = Adult(
firstName: "Lorem ipsum dolor sit amet",
lastName: "Lorem ipsum dolor sit amet",
hasChildren: true,
totalEarned: 123.45,
totalTipped: 123.45,
phoneNumber: "(555) 123-6789");
await Amplify.DataStore.save(item).then((value) => print("done"));
} catch (e) {
print("Someting went wrong $e");
}
}
}

</details>


@HuiSF
Copy link
Member

HuiSF commented Aug 20, 2021

Hello @otabek1 , thanks for opening this issue.
To my knowledge, org.slf4j.impl.StaticLoggerBinder warning was thrown from System Logger not amplify libraries. And it doesn't block amplify cloud syncing.

Here are some tips to help you resolve the issue:

  • Check the content of lib/amplifyconfiguration.dart if it has correct configuration
  • Check App running log, do you see something similar to below item?
I/amplify:aws-datastore(11946): Orchestrator transitioning from LOCAL_ONLY to SYNC_VIA_API
I/amplify:aws-datastore(11946): Setting currentState to SYNC_VIA_API
I/amplify:aws-datastore(11946): Starting API synchronization mode.
  • Check if you see any error message around Setting currentState to SYNC_VIA_API.
  • Do you see any errors/exceptions after executing save operation?

@otabek1
Copy link
Author

otabek1 commented Aug 20, 2021

Hey @HuiSF Thanks for the quick reply.

Here are my logs and there does not seem to be any issue:
I/amplify:aws-datastore(12408): Successfully enqueued PendingMutation{mutatedItem=SerializedModel{id='a6506aa0-a1b6-42f8-a30c-73ceeffe91b0', serializedData={firstName=Lorem ipsum dolor sit amet, lastName=Lorem ipsum dolor sit amet, totalEarned=123.45, phoneNumber=(555) 123-6789, hasChildren=true, totalTipped=123.45, id=a6506aa0-a1b6-42f8-a30c-73ceeffe91b0}, modelName=Adult}, mutationType=CREATE, mutationId=4756adb3-015a-11ec-a6a4-73a67a16df0d, predicate=MatchAllQueryPredicate}
I/amplify:aws-datastore(12408): Successfully removed from mutations outboxPendingMutation{mutatedItem=SerializedModel{id='a6506aa0-a1b6-42f8-a30c-73ceeffe91b0', serializedData={firstName=Lorem ipsum dolor sit amet, lastName=Lorem ipsum dolor sit amet, totalEarned=123.45, phoneNumber=(555) 123-6789, hasChildren=true, totalTipped=123.45, id=a6506aa0-a1b6-42f8-a30c-73ceeffe91b0}, modelName=Adult}, mutationType=CREATE, mutationId=4756adb3-015a-11ec-a6a4-73a67a16df0d, predicate=MatchAllQueryPredicate}

But it is still not showing up in Admin UI

@HuiSF
Copy link
Member

HuiSF commented Aug 20, 2021

Successfully removed from mutations outboxPendingMutation

This message usually means the locally saved data has been synced to cloud successfully. Could you also check from the DynamoDB console, see if the data has been written into the tables?

@otabek1
Copy link
Author

otabek1 commented Aug 20, 2021

I checked it is empty.

@Jordan-Nelson Jordan-Nelson added the datastore Issues related to the DataStore Category label Aug 20, 2021
@b-cancel
Copy link

This is a bug report I just filed that includes a couple of bugs I found and the workarounds to each
after reading your bug report I think it could help
#822

@HuiSF
Copy link
Member

HuiSF commented Aug 21, 2021

@otabek1 could you please paste the schema of the model that cannot be synced to cloud? (you can find the schema in amplify/backend/api/<your api name>/schema.graphql).

@HuiSF
Copy link
Member

HuiSF commented Aug 26, 2021

Hi @otabek1 I wanted to follow up about this issue.

We have two know issues may prevent model data to be synced to cloud.

Could you please take a look at the description see if any of them happen to match your use case?

  1. Issue 1
  2. Issue 2

@offlineprogrammer offlineprogrammer added the pending-close-response-required The issue will be closed if details necessary to reproduce the issue are not provided within 7 days. label Aug 30, 2021
@offlineprogrammer
Copy link
Contributor

Hey @otabek1

I am closing this issue for now as we didn't hear from you
We can reopen it if you are still facing the issue and when you provide details

Regards
Mo

@atomicalsoftwares
Copy link

atomicalsoftwares commented Aug 25, 2022

I'm having this EXACT same issue and I cannot find when or how it stopped working.

type Configuration @model @auth(rules: [{allow: private}, {allow: private, provider: iam}]) {
id: ID!
var1: String
var2: String!
var3: String
var4: String
var5: String
var6: String
var7: String
}

Result after save:

15509-15646 I/art: Rejecting re-init on previously-failed class java.lang.Class<io.reactivex.rxjava3.internal.jdk8.CompletionStageConsumer>
15509-15643 I/amplify:aws-datastore: Orchestrator lock acquired.
15509-15653 I/amplify:aws-datastore: Orchestrator transitioning from STOPPED to SYNC_VIA_API
15509-15653 I/amplify:aws-datastore: Starting to observe local storage changes.
15509-15655 I/art: Rejecting re-init on previously-failed class java.lang.Class<io.reactivex.rxjava3.internal.jdk8.FlowableStageSubscriber>
15509-15655 I/art: Rejecting re-init on previously-failed class java.lang.Class<io.reactivex.rxjava3.internal.jdk8.FlowableStageSubscriber>
15509-15655 I/art: Rejecting re-init on previously-failed class java.lang.Class<io.reactivex.rxjava3.internal.jdk8.FlowableFirstStageSubscriber>
15509-15655 I/art: Rejecting re-init on previously-failed class java.lang.Class<io.reactivex.rxjava3.internal.jdk8.FlowableFirstStageSubscriber>
15509-15655 I/art: Rejecting re-init on previously-failed class java.lang.Class<io.reactivex.rxjava3.internal.jdk8.FlowableFirstStageSubscriber>
15509-15655 I/amplify:aws-datastore: Now observing local storage. Local changes will be enqueued to mutation outbox.
15509-15655 I/amplify:aws-datastore: Setting currentState to LOCAL_ONLY
15509-15653 I/amplify:aws-datastore: Setting currentState to SYNC_VIA_API
15509-15652 I/amplify:aws-datastore: Starting API synchronization mode.
15509-15653 I/amplify:aws-datastore: Orchestrator lock released.

I/amplify:aws-datastore: Successfully removed from mutations outboxPendingMutation
15509-15657 I/APP: Configutation: Configuration {<------redacted------> , createdAt=null, updatedAt=null}
15509-15652 I/amplify:aws-datastore: Starting processing subscription events.
15509-15652 I/amplify:aws-datastore: Started subscription processor for models: [Configuration] of types [ON_CREATE, ON_UPDATE, ON_DELETE].

But it simply will not show in DynamoDB or Admin UI.

@atomicalsoftwares
Copy link

@otabek1 are you using a specific version of okhttp in your android library?

If yes, update to the latest will resolve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datastore Issues related to the DataStore Category pending-close-response-required The issue will be closed if details necessary to reproduce the issue are not provided within 7 days.
Projects
None yet
Development

No branches or pull requests

6 participants