-
Notifications
You must be signed in to change notification settings - Fork 200
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 v2 increases Auth.signin() time by 3x #3007
Comments
Amplify v1 configuration
Amplify v2 configuration
|
@sebsto @harsh62 I've been trying to reproduce this issue in the AWS SDK for Swift but can't reproduce the type of delays you are reporting. I note that it says above that you tried to reproduce in a clean / new project but couldn't. Do you have a code sample or some other way to attempt to recreate the issue? |
@jbelkins The code we use in the project is exactly the same as in the official documentation here: https://docs.amplify.aws/lib/auth/signin/q/platform/ios/#sign-in-a-user I am not sure about the clean project as we only tried on different Amplify SDK versions - I will try to set up new amplify project and replicate it there. |
@jbelkins I have created a sample project to demonstrate the issue. You can find it here: https://github.com/fzy-spyro/AmplifySlowSignin on "main" branch I am using amplify 2.15.1 where signin usually takes > 3 seconds. Logs from the execution are eg:
Repository also has a amplify-v1 branch to showcase that it takes significantly shorter to sign in with amplify v1 eg 1.30. This can be seen by the same print statements
|
This might be a little out of context, but is there a way to turn off the logs during the execution of all the Auth functions? I've even tried to set the LogLevel to .none when configuring Amplify and it still doesn't help |
@smbrmoyo
Do not forget to import Here is how I do it |
It works. Thank you very much! |
@jbelkins Is there any news here? |
@fzy-spyro Thank you much for the sample project you linked above. I created an account with it, then repeatedly logged in to test login times. It was immensely useful for troubleshooting this issue. The issue appears to be that HTTP connections are not being reused when appropriate. The login request above requires four HTTP requests to complete, and a new connection is being made for each one. When connections are properly reused, signin times appear to be comparable to the Amplify v1 branch. We will prepare a fix for aws-sdk-swift, which will then need to be shipped in amplify-swift. For visibility, the problem in aws-sdk-swift is tracked in awslabs/aws-sdk-swift#1035. |
@jbelkins Thanks for the update. I'm glad that the project helped to pinpoint the issues. Looking forward for the fix :) |
A have a question on how the http-sdk works. While doing investigation of this issue on my end I was using a proxy tool to intercept http traffic to understand if this was a network issue etc. What I've observed that with Amplify v1 SDK I could easily see http calls to cognito in proxy (eg proxyman) but when using Amplify V2 those calls were not there. What was more suprprising was that I wasn't able to intercept cognito calls only, graphql or REST request going through eg. APIPlugin were easily tracable in the proxy. Does the cognito http-sdk has something to do with it? Does it somehow hide this requests from proxies? |
Hi @fzy-spyro, feel free to open another issue directly with the swift SDK to get more visibility on your last question here: https://github.com/awslabs/aws-sdk-swift/issues |
Thanks @lawmicha will do. and regarding the fix for the signin time - I see that the sdk team has released the fix: awslabs/aws-sdk-swift#1035 |
@fzy-spyro amplify 2.22.0 has been released yesterday. It includes SDK 0.31.0 with the fix you mentioned. https://github.com/aws-amplify/amplify-swift/releases/tag/2.22.0 Please try it out as soon as you can and report back the status here. |
@sebsto @lawmicha I am still seeing the same behavior with amplify sdk 2.25.5. signin requests lasts for ~3-4 seconds. logs:
I've raised new issue: #3486 |
Describe the bug
We have recently migrated to using AWS Amplify SDK for iOS v2.11 and have observed that ~3/10 sign-in operation take significant time to complete (5-10 sec). This was not happening when we were using AWS Amplify SDK v.1.27. The slow response time is related to following API call: https://docs.amplify.aws/lib/auth/signin/q/platform/ios/#sign-in-a-user.
It sometimes “hangs” for 5-10 seconds before completing. We have tried looking into network calls via Proxyman app but we’ve found that the Cognito call are not visible there when using Amplify SDK v2 (eg. As opposed to v1 or other call like AppSync). We have not been able to reproduce the issue when using AWS CLI commands (cognito-idp) - it takes ~1-2 sec to get response.
We have seen similar reports for Amplify framework on other platforms as well, eg: aws-amplify/amplify-js#5539
I am attaching log files and amplifyconfiguration.json files for the few tests I did. Please also see my observations below:
I compared sign-in times when using Amplify SDK v2.11.5 and v1.29.0 in our app and results are as follow:
When using v1 SDK signin call takes ~1-2 sec. (we use exactly the same api calls as in the documentation: https://docs.amplify.aws/lib-v1/auth/signin/q/platform/ios/#sign-in-a-user)
When using v2 SDK the same signin calls take 5-6 sec, sometimes even more. (same as above, we use the same api calls as in the documentation: https://docs.amplify.aws/lib/auth/signin/q/platform/ios/#sign-in-a-user)
What is more, for a application configuration where we use Amplify SDK v1 there is additional Lambda function configured as a PostSignin trigger in Cognito UserPool. Even with this Lambda signin operation only takes ~1-2s when using v1 SDK as compared to 5-6s when using Amplify SDK v2 with no Lambda.
Steps To Reproduce
Expected behavior
Signin time latency should not increase when migrating an app from Amplify v1 to v2
Amplify Framework Version
2.11.5
Amplify Categories
Auth
Dependency manager
Swift PM
Swift version
5.7
CLI version
12.0.0
Xcode version
14.3.1
Relevant log output
Amplify v1 (OK) logs
Amplify v2 (NOT OK) logs
Is this a regression?
Yes
Regression additional context
No response
Device
all
iOS Version
multiple
Specific to simulators
no
Additional context
No response
The text was updated successfully, but these errors were encountered: