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

Platform exception when initializing #86

Closed
mattRiddoch opened this issue Aug 26, 2020 · 2 comments
Closed

Platform exception when initializing #86

mattRiddoch opened this issue Aug 26, 2020 · 2 comments
Labels
core Issues related to the Amplify Core Plugin to-be-reproduced Issues that have not been reproduced yet, but have reproduction steps provided

Comments

@mattRiddoch
Copy link

Describe the bug
When running the app
await amplifyInstance.configure(amplifyconfig);
raises this error:
PlatformException (PlatformException(AmplifyException, Failed to Configure Amplify, The operation couldn’t be completed. (Amplify.PluginError error 2.), null))
To Reproduce
Steps to reproduce the behavior:

  1. Follow docs starting here: https://docs.amplify.aws/lib/project-setup/create-application/q/platform/flutter
  2. Run app.
  3. Raise exception.

Expected behavior
App to complete configuration error free
amplifyconfiguration.dart created without issues

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

Smartphone (please complete the following information):

  • Device: Simulator 11 Pro
  • OS: iOS 13.6

Additional context
pubspec.yaml:

amplify_core: '<1.0.0'
amplify_auth_cognito: '<1.0.0'
amplify_storage_s3: '<1.0.0'
amplify_analytics_pinpoint: '<1.0.0'

main.dart:

imports...
(in app state)

Amplify amplifyInstance = Amplify();
 @override
 void initState() {
   super.initState();
   _configureAmplify();
 }

 void _configureAmplify() async {
   AmplifyAnalyticsPinpoint analyticsPlugin = AmplifyAnalyticsPinpoint();
   AmplifyAuthCognito authPlugin = AmplifyAuthCognito();
   amplifyInstance.addPlugin(authPlugins: [authPlugin]);
   amplifyInstance.addPlugin(analyticsPlugins: [analyticsPlugin]);
   await amplifyInstance.configure(amplifyconfig);//<-- Error Here!!
 }

amplifyconfiguration.dart:

const amplifyconfig = ''' {
    "UserAgent": "aws-amplify-cli/2.0",
    "Version": "1.0",
    "auth": {
        "plugins": {
            "awsCognitoAuthPlugin": {
                "UserAgent": "aws-amplify-cli/0.1.0",
                "Version": "0.1.0",
                "IdentityManager": {
                    "Default": {}
                },
                "CredentialsProvider": {
                    "CognitoIdentity": {
                        "Default": {
                            "PoolId": "...",
                            "Region": "us-east-1"
                        }
                    }
                },
                "CognitoUserPool": {
                    "Default": {
                        "PoolId": "us-east-1_BIv5TRO9E",
                        "AppClientId": "...",
                        "AppClientSecret": "...",
                        "Region": "us-east-1"
                    }
                },
                "Auth": {
                    "Default": {
                        "authenticationFlowType": "USER_SRP_AUTH"
                    }
                },
                "PinpointAnalytics": {
                    "Default": {
                        "AppId": "...",
                        "Region": "us-east-1"
                    }
                },
                "PinpointTargeting": {
                    "Default": {
                        "Region": "us-east-1"
                    }
                }
            }
        }
    },
    "analytics": {
        "plugins": {
            "awsPinpointAnalyticsPlugin": {
                "pinpointAnalytics": {
                    "appId": "...",
                    "region": "us-east-1"
                },
                "pinpointTargeting": {
                    "region": "us-east-1"
                }
            }
        }
    }
}''';
@Ashish-Nanda Ashish-Nanda added core Issues related to the Amplify Core Plugin to-be-reproduced Issues that have not been reproduced yet, but have reproduction steps provided labels Aug 26, 2020
@Ashish-Nanda
Copy link
Contributor

Hi @mattRiddoch

Could you try removing the storage dependency you have in your pubspec.yaml?

It is possible the configure call is failing since you do not have any storage config in your amplifyconfiguration.dart.
That is also where your code differs from the docs setup steps.

Please run a flutter clean and then flutter run after as well.

@mattRiddoch
Copy link
Author

Yeah removing the storage dependency did the trick! I will take the liberty of closing this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Issues related to the Amplify Core Plugin to-be-reproduced Issues that have not been reproduced yet, but have reproduction steps provided
Projects
None yet
Development

No branches or pull requests

2 participants