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

Amplify.Auth.SignIn() is taking > 4 seconds to complete #3486

Closed
fzy-github opened this issue Jan 29, 2024 · 9 comments
Closed

Amplify.Auth.SignIn() is taking > 4 seconds to complete #3486

fzy-github opened this issue Jan 29, 2024 · 9 comments
Assignees
Labels
auth Issues related to the Auth category bug Something isn't working

Comments

@fzy-github
Copy link

fzy-github commented Jan 29, 2024

Describe the bug

This is clone of #3007

We are using Amplify SDK v 2.25.5 and are observing Auth.SignIn() requests taking > 4 seconds to complete vs the same request taking < 2s on Amplify SDK v1.x

Steps To Reproduce

Build simple app to sign in/sign out users

Sample app available eg: https://github.com/fzy-spyro/AmplifySlowSignin

Expected behavior

Auth.SignIn() requests time is not different between sdk version and does not last > 4 sec. Up to ~ 2 sec is acceptable.

Amplify Framework Version

2.25.5

Amplify Categories

Auth

Dependency manager

Swift PM

Swift version

5.8

CLI version

12.8.2

Xcode version

15.1

Relevant log output

log coming from my sample app when using SDK 2.25.5:

⏰ signIn() clicked!
2024-01-29T13:52:59+0100 info CognitoIdentityProviderClient : [Logging] Request: POST https:443 
 Path: / 
 User-Agent: aws-sdk-swift/1.0 ua/2.0 api/cognito_identity_provider#1.0 os/ios#17.0.1 lang/swift#5.9 cfg/retry-mode#legacy, 
Content-Type: application/x-amz-json-1.1, 
Content-Length: 6684, 
Host: cognito-idp.us-west-2.amazonaws.com, 
X-Amz-Target: AWSCognitoIdentityProviderService.InitiateAuth 
 nil
2024-01-29T13:52:59+0100 info SerialExecutor : [Logging] Creating connection pool for cognito-idp.us-west-2.amazonaws.com with max connections: 50
2024-01-29T13:52:59+0100 info CRTClientEngine : [Logging] Connection was acquired to: Optional("https://cognito-idp.us-west-2.amazonaws.com/")
2024-01-29T13:52:59+0100 info CRTClientEngine : [Logging] Using HTTP/1.1 connection
2024-01-29T13:52:59+0100 info HttpContent : [Logging] read 6684 bytes from data
2024-01-29T13:53:00+0100 info CRTClientEngine : [Logging] Main headers received
2024-01-29T13:53:00+0100 info CRTClientEngine : [Logging] Body chunk received
2024-01-29T13:53:00+0100 info CRTClientEngine : [Logging] Request/response completed
2024-01-29T13:53:00+0100 info CognitoIdentityProviderClient : [Logging] Request: POST https:443 
 Path: / 
 Content-Type: application/x-amz-json-1.1, 
X-Amz-Target: AWSCognitoIdentityProviderService.RespondToAuthChallenge, 
User-Agent: aws-sdk-swift/1.0 ua/2.0 api/cognito_identity_provider#1.0 os/ios#17.0.1 lang/swift#5.9 cfg/retry-mode#legacy, 
Content-Length: 7860, 
Host: cognito-idp.us-west-2.amazonaws.com 
 nil
2024-01-29T13:53:00+0100 info SerialExecutor : [Logging] Creating connection pool for cognito-idp.us-west-2.amazonaws.com with max connections: 50
2024-01-29T13:53:00+0100 info CRTClientEngine : [Logging] Connection was acquired to: Optional("https://cognito-idp.us-west-2.amazonaws.com/")
2024-01-29T13:53:00+0100 info CRTClientEngine : [Logging] Using HTTP/1.1 connection
2024-01-29T13:53:00+0100 info HttpContent : [Logging] read 7860 bytes from data
2024-01-29T13:53:01+0100 info CRTClientEngine : [Logging] Main headers received
2024-01-29T13:53:01+0100 info CRTClientEngine : [Logging] Body chunk received
2024-01-29T13:53:01+0100 info CRTClientEngine : [Logging] Request/response completed
2024-01-29T13:53:01+0100 info CognitoIdentityClient : [Logging] Request: POST https:443 
 Path: / 
 X-Amz-Target: AWSCognitoIdentityService.GetId, 
Content-Length: 1225, 
User-Agent: aws-sdk-swift/1.0 ua/2.0 api/cognito_identity#1.0 os/ios#17.0.1 lang/swift#5.9 cfg/retry-mode#legacy, 
Content-Type: application/x-amz-json-1.1, 
Host: cognito-identity.us-west-2.amazonaws.com 
 nil
2024-01-29T13:53:01+0100 info SerialExecutor : [Logging] Creating connection pool for cognito-identity.us-west-2.amazonaws.com with max connections: 50
2024-01-29T13:53:02+0100 info CRTClientEngine : [Logging] Connection was acquired to: Optional("https://cognito-identity.us-west-2.amazonaws.com/")
2024-01-29T13:53:02+0100 info CRTClientEngine : [Logging] Using HTTP/1.1 connection
2024-01-29T13:53:02+0100 info HttpContent : [Logging] read 1225 bytes from data
2024-01-29T13:53:02+0100 info CRTClientEngine : [Logging] Main headers received
2024-01-29T13:53:02+0100 info CRTClientEngine : [Logging] Body chunk received
2024-01-29T13:53:02+0100 info CRTClientEngine : [Logging] Request/response completed
2024-01-29T13:53:02+0100 info CognitoIdentityClient : [Logging] Request: POST https:443 
 Path: / 
 User-Agent: aws-sdk-swift/1.0 ua/2.0 api/cognito_identity#1.0 os/ios#17.0.1 lang/swift#5.9 cfg/retry-mode#legacy, 
Host: cognito-identity.us-west-2.amazonaws.com, 
Content-Length: 1221, 
X-Amz-Target: AWSCognitoIdentityService.GetCredentialsForIdentity, 
Content-Type: application/x-amz-json-1.1 
 nil
2024-01-29T13:53:02+0100 info SerialExecutor : [Logging] Creating connection pool for cognito-identity.us-west-2.amazonaws.com with max connections: 50
2024-01-29T13:53:03+0100 info CRTClientEngine : [Logging] Connection was acquired to: Optional("https://cognito-identity.us-west-2.amazonaws.com/")
2024-01-29T13:53:03+0100 info CRTClientEngine : [Logging] Using HTTP/1.1 connection
2024-01-29T13:53:03+0100 info HttpContent : [Logging] read 1221 bytes from data
2024-01-29T13:53:03+0100 info CRTClientEngine : [Logging] Main headers received
2024-01-29T13:53:03+0100 info CRTClientEngine : [Logging] Body chunk received
2024-01-29T13:53:03+0100 info CRTClientEngine : [Logging] Request/response completed
Signin result: AuthSignInResult(nextStep: Amplify.AuthSignInStep.done)
⏰ signIn() finished! 4.270425081253052


### Is this a regression?

Yes

### Regression additional context

see initial ticket: https://github.com/aws-amplify/amplify-swift/issues/3007


### Platforms

iOS

### OS Version

16, 17

### Device

any 

### Specific to simulators

no

### Additional context

_No response_
@fzy-github
Copy link
Author

Comparable log when using eg. Amplify SDK v 1.30.6 :

⏰ signIn() clicked!
Signin result: success(Amplify.AuthSignInResult(nextStep: Amplify.AuthSignInStep.done))
⏰ signIn() finished! 1.4222168922424316

@harsh62
Copy link
Member

harsh62 commented Jan 30, 2024

Linking original SDK issue: awslabs/aws-sdk-swift/issues/1035

@harsh62
Copy link
Member

harsh62 commented Jan 30, 2024

@fzy-spyro Thanks for opening the issue. Our team will investigate and provide an update.

@5d 5d added auth Issues related to the Auth category bug Something isn't working labels Jan 30, 2024
@harsh62 harsh62 self-assigned this Feb 15, 2024
@fzy-github
Copy link
Author

@harsh62 any update on the issue above?

@harsh62
Copy link
Member

harsh62 commented Feb 19, 2024

@fzy-spyro Thanks for your patience. I have an open PR that updates the SDK dependency which is now using Foundation as the default HTTP client. Hopefully I can get this to finish line this week and release it as soon as possible.

@harsh62
Copy link
Member

harsh62 commented Feb 20, 2024

@fzy-spyro If in the meantime, can you try to use swift-sdk-update branch in your project, and validate if it fixes your issue?

@fzy-github
Copy link
Author

hey, sure, I'll check the branch in the sample app I shared and let you know the results

@harsh62
Copy link
Member

harsh62 commented Feb 23, 2024

@fzy-spyro Amplify has updated the SDK dependency and pushed out a new update. i.e. 2.27.0. This should considerably improve network performance. Please reopen the issue with more details, if you are still experiencing this issue.

@harsh62 harsh62 closed this as completed Feb 23, 2024
Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

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
Development

No branches or pull requests

3 participants