Amplify-ios: Error configuring AmplifyPlugins.AWSCognitoAuthPlugin after updating Amplify to 1.0.2

Created on 26 Jun 2020  ·  8Comments  ·  Source: aws-amplify/amplify-ios

Describe the bug
After updating Amplify to 1.0.2 I started getting the following error

AuthError: Error configuring AmplifyPlugins.AWSCognitoAuthPlugin
Recovery suggestion: Could not read Cognito identity pool information from the configuration. Make sure that auth category
is properly configured and auth information are present in the configuration. You can use Amplify CLI to
configure the auth category.
  ▿ configuration : 3 elements
    - .0 : "Error configuring AmplifyPlugins.AWSCognitoAuthPlugin"
    - .1 : "Could not read Cognito identity pool information from the configuration. Make sure that auth category\nis properly configured and auth information are present in the configuration. You can use Amplify CLI to\nconfigure the auth category."
    - .2 : nil

Here's the content of my awsconfiguration.json

{
    "UserAgent": "aws-amplify/cli",
    "Version": "0.1.0",
    "IdentityManager": {
        "Default": {}
    },
    "CognitoUserPool": {
        "Default": {
            "PoolId": "POOL_ID",
            "AppClientId": "CLIENT_ID",
            "AppClientSecret": "SECRET",
            "Region": "REGION"
        }
    },
    "Auth": {
        "Default": {
            "authenticationFlowType": "USER_SRP_AUTH"
        }
    }
}

amplifyconfiguration.json

{
    "UserAgent": "aws-amplify-cli/2.0",
    "Version": "1.0",
    "auth": {
        "plugins": {
            "awsCognitoAuthPlugin": {
                "UserAgent": "aws-amplify/cli",
                "Version": "0.1.0",
                "IdentityManager": {
                    "Default": {}
                },
                "CognitoUserPool": {
                    "Default": {
                        "PoolId": "POOL_ID",
                        "AppClientId": "CLIENT_ID",
                        "AppClientSecret": "SECRET",
                        "Region": "REGION"
                    }
                },
                "Auth": {
                    "Default": {
                        "authenticationFlowType": "USER_SRP_AUTH"
                    }
                }
            }
        }
    }
}

To Reproduce
Steps to reproduce the behavior:
Follow the steps in iOS Authentication guide - https://docs.amplify.aws/lib/auth/getting-started/q/platform/ios

Expected behavior
A clear and concise description of what you expected to happen.

Environment(please complete the following information):

  • Amplify Framework Version: 1.0.2
  • Dependency Manager: CocoaPods
  • Swift Version: 5.2
  • Xcode Version: 11.5
  • Amplify CLI version: 4.22.0

Device Information (please complete the following information):

  • Device: Simulator
  • iOS Version: iOS 13.5
auth bug

All 8 comments

@AboulEinein Thanks for reporting this. We've identified the error and are working on a fix.

@palpatim @royjit thank you! 👍🏼

@palpatim @royjit while the configuration error seems to be fixed, I'm facing another issue while signing in.
The signIn function receives nil when retrieving the user from the user pool, which results in Thread 12: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) exception
AWSMobileClientExtensions.swift line 190

@AboulEinein
I tried to do a username password sign in and it worked without any issue. Few things to clarify:

  1. Do you have any initializing / configuring call to AWSMobileClient
  2. Which Amplify signIn api caused this error?
  3. Your amplifyConfiguration.json remains the same as shown above?
  4. Do you have any initializing / configuring call to AWSInfo

@royjit

1- Amplify is configured as following in the AppDelegate

do {
    try Amplify.add(plugin: AWSCognitoAuthPlugin())
    try Amplify.configure()
    print("Amplify configured with auth plugin")
} catch {
    print("Failed to initialize Amplify with \(error)")
}

2- public func signIn(username: String? = nil, password: String? = nil, options: AuthSignInOperation.Request.Options? = nil, listener: AuthSignInOperation.ResultListener?) -> AuthSignInOperation
3- Yes, the configuration is the same.
4- No

@royjit any updates?

Can we open this as a new issue so we can track it appropriately?

Can we open this as a new issue so we can track it appropriately?

Opened a new issue: https://github.com/aws-amplify/amplify-ios/issues/592

Was this page helpful?
0 / 5 - 0 ratings