Skip to content

signInWithSocialWebUI throws a NullPointerException on 2.2.0 but not on 1.37.10 #2282

Closed
@MrBenjoo

Description

@MrBenjoo

Before opening, please confirm:

Language and Async Model

Kotlin - Coroutines

Amplify Categories

Authentication

Gradle script dependencies

[versions]
amplify = "2.2.0"

[libraries]
com.amplifyframework:core-kotlin:2.2.0
com.amplifyframework:aws-auth-cognito:2.2.0

[gradle plugin]
com.amplifyframework:amplify-tools-gradle-plugin:1.0.2

Environment information

------------------------------------------------------------
Gradle 7.5
------------------------------------------------------------

Build time:   2022-07-14 12:48:15 UTC
Revision:     c7db7b958189ad2b0c1472b6fe663e6d654a5103

Kotlin:       1.6.21
Groovy:       3.0.10
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          1.8.0_275 (AdoptOpenJDK 25.275-b01)
OS:           Windows 10 10.0 amd64

Please include any relevant guides or documentation you're referencing

https://docs.amplify.aws/lib/auth/social/q/platform/android/#update-androidmanifestxml

Describe the bug

Calling Amplify.Auth.signInWithSocialWebUI(AuthProvider.google(), callingActivity) throws a nullpointerexception.

It works when using core-kotlin:0.21.10 and aws-auth-cognito:1.37.10, i am able to sign in without problems.

Reproduction steps (if applicable)

No response

Code Snippet

private suspend fun signInWithSocialWebUI(callingActivity: Activity) = try {
        Amplify.Auth.signInWithSocialWebUI(AuthProvider.google(), callingActivity)
        true
    } catch (exception: Exception) {
        false
    }

Log output

java.lang.NullPointerException at com.amplifyframework.auth.cognito.actions.AuthorizationCognitoActions$initializeFetchAuthSession$$inlined$invoke$1.execute(Action.kt:89) at com.amplifyframework.statemachine.ConcurrentEffectExecutor$execute$1$1.invokeSuspend(ConcurrentEffectExecutor.kt:26) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) Suppressed:
kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@c4f97ba, Dispatchers.Default]

amplifyconfiguration.json

{
  "UserAgent": "aws-amplify-cli/2.0",
  "Version": "1.0",
  "auth": {
    "plugins": {
      "awsCognitoAuthPlugin": {
        "UserAgent": "aws-amplify-cli/0.1.0",
        "Version": "0.1.0",
        "IdentityManager": {
          "Default": {}
        },
        "CredentialsProvider": {
          "CognitoIdentity": {
            "Default": {
              "PoolId": "$poolIdCredentialsProvider",
              "Region": "$region"
            }
          }
        },
        "CognitoUserPool": {
          "Default": {
            "PoolId": "$poolIdCognito",
            "AppClientId": "$clientId",
            "AppClientSecret": "$clientSecret",
            "Region": "$region"
          }
        },
        "Auth": {
          "Default": {
            "OAuth": {
              "WebDomain": "$webDomain",
              "AppClientId": "$clientId",
              "AppClientSecret": "$clientSecret",
              "SignInRedirectURI": "$signInRedirectURI",
              "SignOutRedirectURI": "$signOutRedirectURI",
              "Scopes": [
                "email"
              ]
            },
            "authenticationFlowType": "USER_SRP_AUTH"
          }
        }
      }
    }
  }
}

GraphQL Schema

// Put your schema below this line

Additional information and screenshots

Also, I never got this exception on version 2.0.0.

Metadata

Metadata

Assignees

Labels

authRelated to the Auth category/pluginsbugSomething isn't workingpending-community-responseIssue is pending response from the issue requestor

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions