aws-amplify / amplify-flutter

A declarative library with an easy-to-use interface for building Flutter applications on AWS.
https://docs.amplify.aws
Apache License 2.0
1.33k stars 248 forks source link

Failed to start DataStore #2093

Closed ghost closed 2 years ago

ghost commented 2 years ago

Description

Failed to start DataStore when I call the method Amplify.DataStore.start(); after detecting internet connection.

Log in crashlytics

DataStoreException(message: Failed to start DataStore., recoverySuggestion: Retry., underlyingException: DataStoreException{message=Timed out while starting to observe storage changes., cause=java.lang.RuntimeException: Unable to invoke no-args constructor for interface com.amplifyframework.core.model.Model. Registering an InstanceCreator with Gson for this type may fix this problem., recoverySuggestion=There is a possibility that there is a bug if this error persists. Please take a look at 
https://github.com/aws-amplify/amplify-android/issues to see if there are any existing issues that 
match your scenario, and file an issue with the details of the bug if there isn't.}). Error thrown [Amplify DataStore Error].

Categories

Steps to Reproduce

  1. Generate dev release APK.
  2. Save 5 or more item in offline mode.
  3. Close the app (Kill the app completely)
  4. Activate internet connection (Wi-Fi)
  5. Call the Amplify.DataStore.start(); manually when the app detected internet connection.

Screenshots

No response

Platforms

Android Device/Emulator API Level

API 30

Environment

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.0, on Ubuntu 22.04.1 LTS 5.15.0-47-generic, locale es_CO.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.70.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

• No issues found!

Dependencies

Dart SDK 2.17.0
Flutter SDK 3.0.0
MyApp 1.4.7+45

dependencies:
- amazon_cognito_identity_dart_2 3.0.0 [convert crypto http js]
- amplify_api 0.5.1 [amplify_api_plugin_interface amplify_core amplify_api_android amplify_api_ios collection flutter meta plugin_platform_interface]
- amplify_auth_cognito 0.5.1 [amplify_auth_cognito_android amplify_auth_cognito_ios amplify_auth_plugin_interface amplify_core collection flutter plugin_platform_interface]
- amplify_core 0.5.1 [collection date_time_format flutter meta plugin_platform_interface uuid]
- amplify_datastore 0.5.1 [flutter amplify_datastore_plugin_interface amplify_core plugin_platform_interface meta collection async]
- amplify_flutter 0.5.1 [amplify_analytics_plugin_interface amplify_api_plugin_interface amplify_auth_plugin_interface amplify_core amplify_datastore_plugin_interface amplify_flutter_android amplify_flutter_ios amplify_storage_plugin_interface collection flutter json_annotation meta plugin_platform_interface]
- animate_do 2.0.0 [flutter]
- aws_melonn_signer 1.0.0 [flutter crypto]
- aws_signature_v4 0.1.2 [async aws_common collection convert crypto http json_annotation meta path]
- camera 0.9.4+19 [camera_platform_interface camera_web flutter flutter_plugin_android_lifecycle quiver]
- connectivity_plus 2.2.0 [flutter connectivity_plus_platform_interface connectivity_plus_linux connectivity_plus_macos connectivity_plus_web connectivity_plus_windows]
- cupertino_icons 1.0.3
- dartz 0.10.0
- dio 4.0.6 [http_parser path]
- dotted_border 2.0.0+1 [flutter path_drawing]
- easy_localization 3.0.1 [flutter shared_preferences intl args path easy_logger flutter_localizations]
- email_validator 2.0.1
- equatable 2.0.3 [collection meta]
- firebase_analytics 9.3.3 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter]
- firebase_core 1.21.1 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_crashlytics 2.8.9 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace]
- flavorbanner 2.0.1 [flutter device_info_plus package_info_plus]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]
- flutter_dotenv 5.0.2 [flutter]
- flutter_image_compress 1.1.0 [flutter]
- flutter_screenutil 5.5.3+2 [flutter]
- geolocator 7.7.0 [flutter geolocator_platform_interface geolocator_android geolocator_apple geolocator_web]
- get 4.6.5 [flutter]
- google_fonts 3.0.1 [flutter http path_provider crypto]
- google_maps_flutter 2.1.6 [flutter flutter_plugin_android_lifecycle google_maps_flutter_platform_interface]
- gql_dio_link 0.2.2 [dio gql_exec gql_link meta]
- gradient_widgets 0.6.0 [flutter]
- graphql_flutter 5.1.0 [graphql gql_exec flutter meta path_provider path connectivity_plus hive plugin_platform_interface flutter_hooks]
- hive 2.2.3 [meta crypto]
- hive_flutter 1.1.0 [flutter hive path_provider path]
- image_picker 0.8.5+3 [flutter image_picker_android image_picker_for_web image_picker_ios image_picker_platform_interface]
- intl 0.17.0 [clock path]
- logger 1.1.0
- mobile_scanner 2.0.0 [flutter flutter_web_plugins js]
- mobile_ui 1.2.0 [flutter google_fonts cached_network_image mime shimmer]
- modal_bottom_sheet 2.0.0 [flutter]
- network_inspector 1.0.3 [flutter http dio sqflite provider intl analyzer collection share_plus]
- package_info_plus 1.4.2 [flutter package_info_plus_platform_interface package_info_plus_linux package_info_plus_macos package_info_plus_windows package_info_plus_web]
- path_provider 2.0.5 [flutter path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows]
- permission_handler 10.0.0 [flutter meta permission_handler_android permission_handler_apple permission_handler_windows permission_handler_platform_interface]
- photo_view 0.13.0 [flutter]
- pin_code_fields 7.4.0 [flutter]
- sentry_flutter 6.6.3 [flutter flutter_web_plugins sentry package_info_plus meta]
- shimmer 2.0.0 [flutter]
- timezone 0.8.0 [path]
- url_launcher 6.1.4 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows]
- uuid 3.0.6 [crypto]

Device

Redmi Note 8

OS

Android 11

Deployment Method

Amplify CLI

CLI Version

9.2.1

Additional Context

No response

Amplify Config


{
    "UserAgent": "aws-amplify-cli/2.0",
    "Version": "1.0",
    "api": {
        "plugins": {
            "awsAPIPlugin": {
                "DriversApp": {
                    "endpointType": "GraphQL",
                    "endpoint": "xxxxxxx",
                    "region": "us-east-1",
                    "authorizationType": "AMAZON_COGNITO_USER_POOLS"
                }
            }
        }
    },
    "auth": {
        "plugins": {
            "awsCognitoAuthPlugin": {
                "UserAgent": "aws-amplify-cli/0.1.0",
                "Version": "0.1.0",
                "IdentityManager": {
                    "Default": {}
                },
                "CredentialsProvider": {
                    "CognitoIdentity": {
                        "Default": {
                            "PoolId": "us-east-1:xxxxxx",
                            "Region": "us-east-1"
                        }
                    }
                },
                "CognitoUserPool": {
                    "Default": {
                        "PoolId": "us-east-1_xxxxxx",
                        "AppClientId": "xxxx",
                        "Region": "us-east-1"
                    }
                },
                "Auth": {
                    "Default": {
                        "authenticationFlowType": "USER_SRP_AUTH",
                        "socialProviders": [],
                        "usernameAttributes": [
                            "EMAIL"
                        ],
                        "signupAttributes": [
                            "NAME",
                            "EMAIL",
                            "PHONE_NUMBER"
                        ],
                        "passwordProtectionSettings": {
                            "passwordPolicyMinLength": 8,
                            "passwordPolicyCharacters": [
                                "REQUIRES_LOWERCASE",
                                "REQUIRES_UPPERCASE",
                                "REQUIRES_NUMBERS"
                            ]
                        },
                        "mfaConfiguration": "OFF",
                        "mfaTypes": [],
                        "verificationMechanisms": [
                            "EMAIL"
                        ]
                    }
                },
                "S3TransferUtility": {
                    "Default": {
                        "Bucket": "xxxxxx",
                        "Region": "us-east-1"
                    }
                },
                "AppSync": {
                    "Default": {
                        "ApiUrl": "xxxxx",
                        "Region": "us-east-1",
                        "AuthMode": "AMAZON_COGNITO_USER_POOLS",
                        "ClientDatabasePrefix": "xxxxx"
                    },
                    "DriversApp_AWS_IAM": {
                        "ApiUrl": "xxxxx",
                        "Region": "us-east-1",
                        "AuthMode": "AWS_IAM",
                        "ClientDatabasePrefix": "xxxxx"
                    }
                }
            }
        }
    },
    "storage": {
        "plugins": {
            "awsS3StoragePlugin": {
                "bucket": "xxxxxxx",
                "region": "us-east-1",
                "defaultAccessLevel": "guest"
            }
        }
    }
}```
ghost commented 2 years ago

Any updated?

dnys1 commented 2 years ago

Hi @3nd3rs0nn - sorry you are facing this issue. I noticed you are using 0.5.1 for the library version - would you be willing to update to the latest (0.6.7) and let me know if the problem is still reproduced?

Jordan-Nelson commented 2 years ago

Hi @3nd3rs0nn - Have you had a chance to see if this issue persists on the latest version of Amplify Flutter?