-
Notifications
You must be signed in to change notification settings - Fork 252
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
AmplifyException on Datastore re-initialization #5793
Comments
Hello @veeramneni, this sounds like a duplicate of this issue, please let me know if you agree. Internally we are not handling an exception properly, which is causing this exception to be thrown rather than logging and failing silently. We have a PR open with a fix, but we are waiting for a test to be fixed prior to merging. |
Thank's for your response. Yes, it is indeed the same issue and we can ignore this exception on our end. However, Datastore is not able to successfully start the sync after this. Even after stop, clear and start, I see hub event stuck in 'Outbox' status. I neither see any configuration error nor other event's. Am I missing something?(Auth and API are fine) |
DataStore's internal Auth configuration breaks with this exception. Any DataStore API calls afterwards will make the changes locally and they will remain your Outbox until you restart the app with a properly configured DataStore. If you want to verify these changes fully resolve your issue you can add a pubspec_overrides.yaml file to your project with the following content:
Just remember to delete these overrides afterwards! |
Thanks again! This does safely ignore exception but the exception itself is resulting when the app is restarted. So upon original launch plugin gets initialized like so:
Once app is killed and restarted, it appears like native android is keeping part of amplify configuration alive(possibly because of background services?). So, the exception from your branch does safely ignore reconfiguration error, however Amplify Datastore is not properly configured. Is there a way to force clear any amplify configuration lingering in the background so Amplify gets re-initialized properly? This is how the relaunch log looks like. As you can see, plugins are not initialized again and Datastore is not syncing as expected.
|
For internal testing purposes we have an |
Description
I have Amplify setup for Auth, API and Datastore. They are configured without an issue on app launch. However, upon killing the app and relaunching, amplify configuration fails with below error.
AmplifyException{message=User-Agent was already configured successfully., cause=null, recoverySuggestion=User-Agent is configured internally during Amplify configuration. This method should not be called externally.}
I am not sure where it's picking User-agent from. I understand it is set automatically by Amplify. Amplify.isConfigured is indeed false before reconfiguration. So I know it is not configured before trying again.
Any ideas or thoughts are much appreciated
If it helps, the exception is being triggered in amplify_datastore.dart at this code
try {
final nativeBridge = NativeAmplifyBridge();
await nativeBridge.configure(
Amplify.version,
jsonEncode(config.toJson()),
);
} on PlatformException catch (e) {
if (e.code == 'AmplifyException') {
Categories
Steps to Reproduce
Screenshots
No response
Platforms
Flutter Version
3.34.4
Amplify Flutter Version
2.5.0
Deployment Method
Amplify Gen 2
Schema
No response
The text was updated successfully, but these errors were encountered: