Closed Sushil787 closed 5 days ago
@Sushil787 sorry that you are facing this issue, Can you please share your amplifyconfiguration.dart with any sensitive info removed? Also what version of Amplify CLI do you use?
@NikaHsn
amplify --version
12.12.4
This is the amplifyConfiguration.dart const amplifyconfig = '''{ "UserAgent": "aws-amplify-cli/2.0", "Version": "1.0", "api": { "plugins": { "awsAPIPlugin": { "witpage": { "endpointType": "GraphQL", "endpoint": "https://dummy.dummy-api.us-west-1.amazonaws.com/graphql", "region": "us-west-1", "authorizationType": "API_KEY", "apiKey": "da2-dummy" } } } }, "auth": { "plugins": { "awsCognitoAuthPlugin": { "UserAgent": "aws-amplify-cli/0.1.0", "Version": "0.1.0", "IdentityManager": { "Default": {} }, "AppSync": { "Default": { "ApiUrl": "https://dummy.appsync-api.us-west-1.amazonaws.com/graphql", "Region": "us-west-1", "AuthMode": "API_KEY", "ApiKey": "da2-dummy", "ClientDatabasePrefix": "witpage_API_KEY" }, "witpage_AWS_IAM": { "ApiUrl": "https://dymmy.appsync-api.us-west-1.amazonaws.com/graphql", "Region": "us-west-1", "AuthMode": "AWS_IAM", "ClientDatabasePrefix": "witpage_AWS_IAM" } }, "CredentialsProvider": { "CognitoIdentity": { "Default": { "PoolId": "us-west-1:9e975edc-6e03-dummy-a987-dymmy", "Region": "us-west-1" } } }, "CognitoUserPool": { "Default": { "PoolId": "us-west-duymmy", "AppClientId": "test", "Region": "us-west-1" } }, "Auth": { "Default": { "authenticationFlowType": "USER_SRP_AUTH", "mfaConfiguration": "OFF", "mfaTypes": [ "SMS" ], "passwordProtectionSettings": { "passwordPolicyMinLength": 8, "passwordPolicyCharacters": [ "REQUIRES_LOWERCASE", "REQUIRES_NUMBERS", "REQUIRES_UPPERCASE" ] }, "signupAttributes": [], "socialProviders": [], "usernameAttributes": [ "EMAIL" ], "verificationMechanisms": [ "EMAIL" ] } }, "S3TransferUtility": { "Default": { "Bucket": "bucket-id", "Region": "us-west-1" } } } } }, "storage": { "plugins": { "awsS3StoragePlugin": { "bucket": "bucket-id, "region": "us-west-1", "defaultAccessLevel": "guest" } } } }''';
thank @Sushil787. we will look into this and get back to you with any updates.
@Sushil787, I used the amplifyConfiguration.dart
you shared but couldn't replicate the problem with our Amplify DataStore example app. However, I stumbled upon another configuration error related to JSON formatting. Specifically, the "bucket-id
value within the "awsS3StoragePlugin"
object was missing a closing double quote ("
). After correcting this, I managed to configure Amplify correctly.
below is the ConfigurationError I got when using theamplifyConfiguration.dart
you shared. could you please verify if you get the same ConfigurationError using the shared amplifyConfiguration.dart
?
ConfigurationError {
"message": "The provided configuration is not a valid json. Check underlyingException.",
"recoverySuggestion": "Inspect your amplify_outputs.dart or amplifyconfiguration.dart and ensure that the string is proper json",
"underlyingException": "FormatException: Control character in string (at line 98, character 33)\n \"bucket\":\"bucket-id,\n ^\n"
Hi @NikaHsn , I have a similar error:
Background concurrent copying GC freed 75929(3681KB) AllocSpace objects, 3(60KB) LOS objects, 49% free, 4417KB/8834KB, paused 2.934ms,14us total 158.244ms I/amplify:flutter:datastore( 8633): Added Auth plugin I/amplify:flutter:datastore( 8633): Added API plugin E/flutter ( 8633): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'Null' is not a subtype of type 'Map<dynamic, dynamic>' in type cast E/flutter ( 8633): #0 AmplifyDataStore.configure (package:amplify_datastore/amplify_datastore.dart:141:46) E/flutter ( 8633): <asynchronous suspension>
IOS doesn't have this error, works fine.
This error only appears on ANDROID (emulator PHONE API 34).
this error happened when use with this packages :
amplify_analytics_pinpoint: 2.2.0 amplify_api: 2.2.0 amplify_api_dart: 0.5.2 amplify_auth_cognito: 2.2.0 amplify_authenticator: 2.1.0 amplify_core: 2.2.0 amplify_datastore: 2.2.0 amplify_datastore_plugin_interface: 2.2.0 amplify_flutter: 2.2.0 amplify_storage_s3: 2.2.0
but using previous versions, this error don't appears:
amplify_analytics_pinpoint: 2.1.0 amplify_api: 2.1.0 amplify_api_dart: 0.5.1 amplify_auth_cognito: 2.1.0 amplify_authenticator: 2.0.1 amplify_core: 2.1.0 amplify_datastore: 2.1.0 amplify_datastore_plugin_interface: 2.1.0 amplify_flutter: 2.1.0 amplify_storage_s3: 2.1.0
============================================
[✓] Flutter (Channel stable, 3.22.2, on macOS 14.5 23F79 darwin-arm64, locale es-CO) • Flutter version 3.22.2 on channel stable at /Users/xontes/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 761747bfc5 (4 weeks ago), 2024-06-05 22:15:13 +0200 • Engine revision edd8546116 • Dart version 3.4.3 • DevTools version 2.34.3
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/xontes/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.4) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15F31d • CocoaPods version 1.15.2
[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2023.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
[✓] VS Code (version 1.91.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.92.0
[✓] Connected device (4 available) • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 14 (API 34) (emulator) • macOS (desktop) • macos • darwin-arm64 • macOS 14.5 23F79 darwin-arm64 • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 14.5 23F79 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 126.0.6478.127
[✓] Network resources • All expected network resources are available.
Kind Regards
related @NikaHsn I may have missed a quote that while removing secrets, I think thats not the issue . Can you share the configuration and which android api level are you working on !! which version of amplify are you using and flutter packages and their versions ?
@NikaHsn i also recently tested for IOS and it's working fine but for android it's not working !! Did you configured Datastore only or all above four at once? All four configuration may cause issue !!
I'm not very experienced but could it be a problem with the latest version of Amplify cli?
Hi @Sushil787, @jamontesg, @Williamjr23, I was able to reproduce the issue and am working to determine the root cause now.
Hi @Sushil787, @jamontesg, @Williamjr23, the fix for this has been released. Please upgrade your amplify-datastore
version to 2.2.1
. I'm going to close this issue now, but please feel free to let us know if you have another issue that pops up or if this issue resurfaces.
Description
DatasStore configuration issue : AWS Amplify with flutter : I'm facing an issue while configuring Amplify DataStore in my Flutter app. The error I'm encountering is: It seems like there might be an issue with the DataStore configuration or possibly with the plugins. Has anyone else faced a similar issue? Any insights or solutions would be greatly appreciated! API,AUTH is configuring with no issue . PS: I have followed as documentation and did researched too . code snippets are provided in snapshot . Unhandled Exception: type 'Null' is not a subtype of type 'Map<dynamic, dynamic>' in type cast this is from package amplify core and datastore as exception is expecting map of exception value but got null. if (e.code == 'AmplifyException') { throw AmplifyException.fromMap( Map<String, String>.from(e.details as Map), ); But, with no exception message !! }
here is my generated model provider : /*
// NOTE: This file is generated and may not follow lint rules defined in your app // Generated files can be excluded from analysis in analysis_options.yaml // For more info, see: https://dart.dev/guides/language/analysis-options#excluding-code-from-analysis
// ignore_for_file: public_member_api_docs, annotate_overrides, dead_code, dead_codepublic_member_api_docs, depend_on_referenced_packages, file_names, library_private_types_in_public_api, no_leading_underscores_for_library_prefixes, no_leading_underscores_for_local_identifiers, non_constant_identifier_names, null_check_on_nullable_type_parameter, override_on_non_overriding_member, prefer_adjacent_string_concatenation, prefer_const_constructors, prefer_if_null_operators, prefer_interpolation_to_compose_strings, slash_for_doc_comments, sort_child_properties_last, unnecessary_const, unnecessary_constructor_name, unnecessary_late, unnecessary_new, unnecessary_null_aware_assignments, unnecessary_nullable_for_final_variable_declarations, unnecessary_string_interpolations, use_build_context_synchronously
package used:
Categories
Steps to Reproduce
Screenshots
Platforms
Flutter Version
3.19.6
Amplify Flutter Version
2.2.0
Deployment Method
Amplify CLI
Schema