-
Notifications
You must be signed in to change notification settings - Fork 198
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
Crash: "SWIFT TASK CONTINUATION MISUSE" in ShowHostedUISign[In/Out].execute #3362
Comments
Thanks for opening this issue. The team will investigate and get back to you as soon as we have more information. |
@maxchuquimia I have been unable to recreate this issue in my local environment. I have also gone through the Auth0 issue that have been attached, and I guess its fundamentally a little different as Auth0 seems to be caching certain requests. In Amplify's case, there is no caching happening and hence the continuations are not reused. Every request creates a new one and the old one is discarded. It would be nice if you can try to recreate this issue and share steps, or provide insights from your users behaviours that could provide in debugging the issue further. |
Thanks @harsh62 -- We are continuing to try and reproduce the issue but have had no success. We can tell from logs that the crash correlates with the device returning to the foreground during authentication (as described in the Auth0 issue via the Control Centre). Despite being unable to reproduce the issue, calling a continuation twice is not supported behavior for concurrency (even if it is indeed some strange |
@maxchuquimia Thanks for reverting back. Would you be able to share a symbolicated crash log that you are seeing. There might be something in the crash log that could give us hint on what the problem could be. |
Hey @harsh62, please find two attached examples (one for signing in and one for signing out). In the traces |
@maxchuquimia Thanks for providing the information. Could you also share the code snippet and surrounding code that is used to call the Amplify.Auth API? |
Hey @harsh62, here's how we use it: func login(with socialAuth: SocialAuth) async throws {
let result: AuthSignInResult
do {
switch socialAuth {
case .google:
result = try await Amplify.Auth.signInWithWebUI(for: .google, options: authOptions.cognitoOptions(provider: .google))
if result.isSignedIn {
authOptions.setLogInCompleted(provider: .google)
}
case .microsoft:
result = try await Amplify.Auth.signInWithWebUI(for: .oidc("Microsoft"), options: authOptions.cognitoOptions(provider: .microsoft))
if result.isSignedIn {
authOptions.setLogInCompleted(provider: .microsoft)
}
case .apple:
result = try await Amplify.Auth.signInWithWebUI(for: .apple, options: authOptions.cognitoOptions(provider: .apple))
if result.isSignedIn {
authOptions.setLogInCompleted(provider: .apple)
}
}
} catch {
throw AppAuthError(cognitoError: error) ?? error
}
_isLoggedInPublisher.send(result.isSignedIn)
} |
@maxchuquimia Thanks for providing more details.. I am still not able to get this crash locally.. Nevertheless, I have made a small fix in #3363 .. Is it possible if you can test the branch in the PR ( |
@harsh62 Thanks for your time on this! I have tried again for a long time this morning to reproduce the crash but still cannot. I also briefly tested your PR branch locally and it didn't seems to cause any new issues. Not sure what the best way forward is now, perhaps we need to release and then see if the crashes stop? |
@maxchuquimia I will work on drafting a release. Amplify is due to release sometime later next week. I will post an update on the issue when that happens. |
The issue ticket is now closed as the fix has been released in the latest version 2.25.0. If you continue to encounter the problem, please don't hesitate to reopen the ticket. |
Unfortunately this is still occurring after upgrading to Amplify Swift 2.25.0 - here are three examples... 51e7adc05d19491b8f25fd7b1f0410fb-symbolicated.crash.txt |
Thanks for letting us know and for the crash logs. We're investigating and will provide an update when we can. |
@maxchuquimia We've released a new version (2.25.4) with the potential fix. |
|
Describe the bug
We are receiving numerous crash logs in production related to the Amplify hosted UI. We are unable to reproduce the issue, however we believe it is similar to an Auth0 issue (see Steps To Reproduce).
Note that we are using async/await APIs in our app to interact with Amplify Swift.
Steps To Reproduce
Expected behavior
The
CheckedContinuation
instance in theShowHostedUISignIn.execute
andShowHostedUISignOut.execute
functions should not be resumed twice. This may be a bug inASWebAuthenticationSession
, however it is causing production crashes so may need to be worked around within the Amplify Swift SDK.Amplify Framework Version
2.21.3 and previous versions
Amplify Categories
Auth
Dependency manager
Swift PM
Swift version
5.7
CLI version
None
Xcode version
15.0.1 (15A507)
Relevant log output
No response
Is this a regression?
No
Regression additional context
No response
Platforms
iOS
OS Version
iOS16+ and iOS17+
Device
Various iOS devices
Specific to simulators
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: