Electric-Coin-Company / zcash-android-wallet-sdk

Native Android SDK for Zcash
MIT License
5 stars 9 forks source link

Broken authentication with Flank on CI tests #1326

Open HonzaR opened 8 months ago

HonzaR commented 8 months ago

Actual behavior + errors

java.lang.NullPointerException: null cannot be cast to non-null type kotlin.String
    at ftl.args.ArgsHelper.getProjectIdFromJson(ArgsHelper.kt:200)
    at ftl.args.ArgsHelper.fromUserProvidedCredentials(ArgsHelper.kt:195)
    at ftl.args.ArgsHelper.getUserProjectId(ArgsHelper.kt:188)
    at ftl.args.ArgsHelper.getDefaultProjectIdOrNull(ArgsHelper.kt:185)
    at ftl.config.common.CommonFlankConfig$Companion.default(CommonFlankConfig.kt:237)
Parsing /home/runner/work/zcash-android-wallet-sdk/zcash-android-wallet-sdk/gha-creds-49b4cf4d64aa3833.json failed:
    at ftl.config.CreateKt.defaultAndroidConfig(Create.kt:16)
    at ftl.domain.RunTestAndroidKt.invoke(RunTestAndroid.kt:42)
    at ftl.presentation.cli.firebase.test.android.AndroidRunCommand.run(AndroidRunCommand.kt:58)
    at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
    at picocli.CommandLine.access$1500(CommandLine.java:148)
    at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
    at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
    at picocli.CommandLine.execute(CommandLine.java:2170)
    at ftl.Main$main$1.invoke(Main.kt:12)
    at ftl.Main$main$1.invoke(Main.kt:10)
    at ftl.run.exception.ExceptionHandlerKt.withGlobalExceptionHandling(ExceptionHandler.kt:24)
    at ftl.run.exception.ExceptionHandlerKt.withGlobalExceptionHandling(ExceptionHandler.kt:14)
    at ftl.Main.main(Main.kt:10)
kotlin.Unit
java.io.IOException: Request failed
    at ftl.http.ExecuteWithRetryKt$executeWithRetry$$inlined$withRetry$1.invokeSuspend(ExecuteWithRetry.kt:37)

    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:233)
    at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:166)
    at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:474)
    at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:508)
    at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default(CancellableContinuationImpl.kt:497)
    at kotlinx.coroutines.CancellableContinuationImpl.resumeUndispatched(CancellableContinuationImpl.kt:595)
    at kotlinx.coroutines.EventLoopImplBase$DelayedResumeTask.run(EventLoop.common.kt:493)
    at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:280)
    at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
    at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
    at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
    at ftl.http.ExecuteWithRetryKt.executeWithRetry(ExecuteWithRetry.kt:[44](https://github.com/Electric-Coin-Company/zcash-android-wallet-sdk/actions/runs/7386926428/job/20095290950#step:6:45))
    at ftl.client.google.GcToolResults.getDefaultBucket(GcToolResults.kt:158)
    at ftl.args.ArgsHelper.createGcsBucket(ArgsHelper.kt:1[45](https://github.com/Electric-Coin-Company/zcash-android-wallet-sdk/actions/runs/7386926428/job/20095290950#step:6:46))
    at ftl.args.CreateCommonArgsKt.createCommonArgs(CreateCommonArgs.kt:18)
    at ftl.args.PrepareAndroidCommonConfigKt.prepareAndroidCommonConfig(PrepareAndroidCommonConfig.kt:11)
    at ftl.args.CreateAndroidArgsKt.createAndroidArgs$default(CreateAndroidArgs.kt:15)
    at ftl.domain.RunTestAndroidKt.invoke(RunTestAndroid.kt:41)
    at ftl.presentation.cli.firebase.test.android.AndroidRunCommand.run(AndroidRunCommand.kt:58)
    at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
    at picocli.CommandLine.access$1500(CommandLine.java:148)
    at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2[46](https://github.com/Electric-Coin-Company/zcash-android-wallet-sdk/actions/runs/7386926428/job/20095290950#step:6:47)1)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
    at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
    at picocli.CommandLine.execute(CommandLine.java:2170)
    at ftl.Main$main$1.invoke(Main.kt:12)
    at ftl.Main$main$1.invoke(Main.kt:10)
    at ftl.run.exception.ExceptionHandlerKt.withGlobalExceptionHandling(ExceptionHandler.kt:24)
    at ftl.run.exception.ExceptionHandlerKt.withGlobalExceptionHandling(ExceptionHandler.kt:14)
    at ftl.Main.main(Main.kt:10)
Caused by: java.io.IOException: Error requesting access token
    at com.google.auth.oauth2.ImpersonatedCredentials.refreshAccessToken(ImpersonatedCredentials.java:512)
    at com.google.auth.oauth2.ExternalAccountCredentials.exchangeExternalCredentialForAccessToken(ExternalAccountCredentials.java:[49](https://github.com/Electric-Coin-Company/zcash-android-wallet-sdk/actions/runs/7386926428/job/20095290950#step:6:50)1)
    at com.google.auth.oauth2.IdentityPoolCredentials.refreshAccessToken(IdentityPoolCredentials.java:183)
    at com.google.auth.oauth2.OAuth2Credentials$1.call(OAuth2Credentials.java:269)
    at com.google.auth.oauth2.OAuth2Credentials$1.call(OAuth2Credentials.java:266)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at com.google.auth.oauth2.OAuth2Credentials$RefreshTask.run(OAuth2Credentials.java:633)
    at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:31)
    at com.google.auth.oauth2.OAuth2Credentials$AsyncRefreshResult.executeIfNew(OAuth2Credentials.java:581)
    at com.google.auth.oauth2.OAuth2Credentials.asyncFetch(OAuth2Credentials.java:232)
    at com.google.auth.oauth2.OAuth2Credentials.getRequestMetadata(OAuth2Credentials.java:182)
    at com.google.auth.oauth2.ExternalAccountCredentials.getRequestMetadata(ExternalAccountCredentials.java:341)
    at com.google.auth.http.HttpCredentialsAdapter.initialize(HttpCredentialsAdapter.java:96)
    at ftl.http.HttpTimeoutIncrease.initialize(HttpTimeoutIncrease.kt:10)
    at com.google.api.client.http.HttpRequestFactory.buildRequest(HttpRequestFactory.java:91)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.buildHttpRequest(AbstractGoogleClientRequest.java:442)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:552)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:493)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:603)
    at ftl.http.ExecuteWithRetryKt$executeWithRetry$$inlined$withRetry$1.invokeSuspend(ExecuteWithRetry.kt:44)
    ... 35 more
Caused by: com.google.api.client.http.HttpResponseException: 403 Forbidden
POST https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/***:generateAccessToken
{
  "error": {
    "code": 403,
    "message": "Permission 'iam.serviceAccounts.getAccessToken' denied on resource (or it may not exist).",
    "errors": [
      {
        "message": "Permission 'iam.serviceAccounts.getAccessToken' denied on resource (or it may not exist).",
        "domain": "global",
        "reason": "forbidden"
      }
    ],
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "IAM_PERMISSION_DENIED",
        "domain": "iam.googleapis.com",
        "metadata": {
          "permission": "iam.serviceAccounts.getAccessToken"
        }
      }
    ]
  }
}

    at com.google.api.client.http.HttpResponseException$Builder.build(HttpResponseException.java:293)
    at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1118)
    at com.google.auth.oauth2.ImpersonatedCredentials.refreshAccessToken(ImpersonatedCredentials.java:[51](https://github.com/Electric-Coin-Company/zcash-android-wallet-sdk/actions/runs/7386926428/job/20095290950#step:6:52)0)
    ... [54](https://github.com/Electric-Coin-Company/zcash-android-wallet-sdk/actions/runs/7386926428/job/20095290950#step:6:55) more

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':demo-app:execFlankSanityConfig'.

Any extra information that might be useful in the debugging process.

HonzaR commented 3 days ago

Testing SDK on Testlab using a connection from the local machine works as expected. The issue is with the CI type of authentication only, as expected.