Skip to content

AmplifyException on Datastore re-initialization #5793

@veeramneni

Description

@veeramneni

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') {

    throw AmplifyException.fromMap(
      Map<String, String>.from(e.details as Map),
    );
    return;
  }

Categories

  • Analytics
  • API (REST)
  • API (GraphQL)
  • Auth
  • Authenticator
  • DataStore
  • Notifications (Push)
  • Storage

Steps to Reproduce

  1. Create an Amplify flutter project with Auth, API and Datastore
  2. Configure it with Amplify.configure
  3. Kill and relaunch the app to re-configure Amplify
  4. Watch for configuration exception.

Screenshots

No response

Platforms

  • iOS
  • Android
  • Web
  • macOS
  • Windows
  • Linux

Flutter Version

3.34.4

Amplify Flutter Version

2.5.0

Deployment Method

Amplify Gen 2

Schema

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    AndroidIssues specific to the Android PlatformbugSomething is not working; the issue has reproducible steps and has been reproduceddatastoreIssues related to the DataStore Category

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions