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

Error configuring AmplifyPlugins.AWSCognitoAuthPlugin after updating Amplify to 1.0.2 #586

Closed
AboulEinein opened this issue Jun 26, 2020 · 8 comments · Fixed by #589
Closed
Assignees
Labels
auth Issues related to the Auth category bug Something isn't working
Milestone

Comments

@AboulEinein
Copy link

AboulEinein commented Jun 26, 2020

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
@palpatim palpatim added auth Issues related to the Auth category bug Something isn't working labels Jun 26, 2020
@palpatim
Copy link
Member

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

@AboulEinein
Copy link
Author

@palpatim @royjit thank you! 👍🏼

@AboulEinein
Copy link
Author

AboulEinein commented Jun 27, 2020

@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

@royjit
Copy link
Contributor

royjit commented Jun 27, 2020

@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

@AboulEinein
Copy link
Author

@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

@AboulEinein
Copy link
Author

@royjit any updates?

@palpatim
Copy link
Member

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

@AboulEinein
Copy link
Author

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

Opened a new issue: #592

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth Issues related to the Auth category bug Something isn't working
Projects
None yet
4 participants