Skip to content

TLS connections do not work on native targets #60

@tobyloki

Description

@tobyloki

I have gotten the grpc request to work on Android, but on iOS, I am getting the below error at runtime: UNKNOWN. The request doesn't reach my server (even if I put a fake server domain, it gives same error). How can I get it working on iOS?

private fun getStub(): AuthStub {
        val channel = Channel.Builder
            .forAddress(_GRPC_HOST, 443)
            .build()
        val stub = AuthStub(channel)
        return stub
    }

override suspend fun validateAccessCode(accessCode: String) = withContext(Utility.CoroutineContextProvider.io) {
        val request = Empty()

        val authMetadata = getAuthMetadata(accessCode)

        try {
            authGrpc.ValidateAccessCode(request, authMetadata)
        } catch (e: Exception) {
            throw GrpcUtility.handleException(e, "authGrpc.ValidateAccessCode")
        }

        return@withContext
    }
io.github.timortel.kmpgrpc.core.StatusException
    at 0   myapp.debug.dylib      0x10cc1bee7        kfun:kotlin.Throwable#<init>(kotlin.Throwable?){} + 243 
    at 1   myapp.debug.dylib      0x10cc15ba3        kfun:kotlin.Exception#<init>(kotlin.Throwable?){} + 95 
    at 2   myapp.debug.dylib      0x10cc15d73        kfun:kotlin.RuntimeException#<init>(kotlin.Throwable?){} + 95 
    at 3   myapp.debug.dylib      0x10cf7152f        kfun:io.github.timortel.kmpgrpc.core.StatusException#<init>(io.github.timortel.kmpgrpc.core.Status;kotlin.Throwable?){} + 167 
    at 4   myapp.debug.dylib      0x10cfa1b5b        kfun:io.github.timortel.kmpgrpc.core.rpc.rpcImplementation$rpcFlow$1.rpcImplementation$rpcFlow$1$invoke$waitForDoneJob$1.$invokeCOROUTINE$3.invokeSuspend#internal + 1127 
    at 5   myapp.debug.dylib      0x10cd69ae7        kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#invokeSuspend(kotlin.Result<kotlin.Any?>){}kotlin.Any?-trampoline + 67 
    at 6   myapp.debug.dylib      0x10cc221cf        kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 691 
    at 7   myapp.debug.dylib      0x10cd69bc7        kfun:kotlin.coroutines.Continuation#resumeWith(kotlin.Result<1:0>){}-trampoline + 99 
    at 8   myapp.debug.dylib      0x10cea0f4f        kfun:kotlinx.coroutines.DispatchedTask#run(){} + 2039 
    at 9   myapp.debug.dylib      0x10ced241f        kfun:kotlinx.coroutines.Runnable#run(){}-trampoline + 91 
    at 10  myapp.debug.dylib      0x10cec9c53        kfun:kotlinx.coroutines.MultiWorkerDispatcher.MultiWorkerDispatcher$workerRunLoop$1.$invokeCOROUTINE$0.invokeSuspend#internal + 2363 
    at 11  myapp.debug.dylib      0x10cd69ae7        kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#invokeSuspend(kotlin.Result<kotlin.Any?>){}kotlin.Any?-trampoline + 67 
    at 12  myapp.debug.dylib      0x10cc221cf        kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 691 
    at 13  myapp.debug.dylib      0x10cd69bc7        kfun:kotlin.coroutines.Continuation#resumeWith(kotlin.Result<1:0>){}-trampoline + 99 
    at 14  myapp.debug.dylib      0x10cea0f4f        kfun:kotlinx.coroutines.DispatchedTask#run(){} + 2039 
    at 15  myapp.debug.dylib      0x10ced241f        kfun:kotlinx.coroutines.Runnable#run(){}-trampoline + 91 
    at 16  myapp.debug.dylib      0x10ce28443        kfun:kotlinx.coroutines.EventLoopImplBase#processNextEvent(){}kotlin.Long + 287 
    at 17  myapp.debug.dylib      0x10ced2197        kfun:kotlinx.coroutines.EventLoop#processNextEvent(){}kotlin.Long-trampoline + 51 
    at 18  myapp.debug.dylib      0x10cec24ef        kfun:kotlinx.coroutines.BlockingCoroutine.joinBlocking#internal + 455 
    at 19  myapp.debug.dylib      0x10cec12ff        kfun:kotlinx.coroutines#runBlocking(kotlin.coroutines.CoroutineContext;kotlin.coroutines.SuspendFunction1<kotlinx.coroutines.CoroutineScope,0:0>){0§<kotlin.Any?>}0:0 + 1487 
    at 20  myapp.debug.dylib      0x10cec14df        kfun:kotlinx.coroutines#runBlocking$default(kotlin.coroutines.CoroutineContext?;kotlin.coroutines.SuspendFunction1<kotlinx.coroutines.CoroutineScope,0:0>;kotlin.Int){0§<kotlin.Any?>}0:0 + 239 
    at 21  myapp.debug.dylib      0x10cec75ff        kfun:kotlinx.coroutines.MultiWorkerDispatcher.workerRunLoop#internal + 195 
    at 22  myapp.debug.dylib      0x10cec9083        kfun:kotlinx.coroutines.MultiWorkerDispatcher.MultiWorkerDispatcher$1.MultiWorkerDispatcher$1$invoke$$inlined$apply$1.invoke#internal + 71 
    at 23  myapp.debug.dylib      0x10cec90df        kfun:kotlinx.coroutines.MultiWorkerDispatcher.MultiWorkerDispatcher$1.MultiWorkerDispatcher$1$invoke$$inlined$apply$1.$<bridge-DN>invoke(){}#internal + 71 
    at 24  myapp.debug.dylib      0x10cd672f3        kfun:kotlin.Function0#invoke(){}1:0-trampoline + 99 
    at 25  myapp.debug.dylib      0x10cc2f59b        WorkerExecuteAfterLaunchpad + 271 
    at 26  myapp.debug.dylib      0x10cdc9edb        _ZN6Worker19processQueueElementEb + 3247 
    at 27  myapp.debug.dylib      0x10cdc90b7        _ZN12_GLOBAL__N_113workerRoutineEPv + 251 
    at 28  libsystem_pthread.dylib             0x21ba17343        _pthread_start + 135 
    at 29  libsystem_pthread.dylib             0x21ba14ab7        thread_start + 7 

07-27 16:27:33.774 ❤️ ERROR Napier.e - gRPC error in authGrpc.ValidateAccessCode
io.github.timortel.kmpgrpc.core.StatusException
    at 0   myapp.debug.dylib      0x10cc1bee7        kfun:kotlin.Throwable#<init>(kotlin.Throwable?){} + 243 
    at 1   myapp.debug.dylib      0x10cc15ba3        kfun:kotlin.Exception#<init>(kotlin.Throwable?){} + 95 
    at 2   myapp.debug.dylib      0x10cc15d73        kfun:kotlin.RuntimeException#<init>(kotlin.Throwable?){} + 95 
    at 3   myapp.debug.dylib      0x10cf7152f        kfun:io.github.timortel.kmpgrpc.core.StatusException#<init>(io.github.timortel.kmpgrpc.core.Status;kotlin.Throwable?){} + 167 
    at 4   myapp.debug.dylib      0x10cfa1b5b        kfun:io.github.timortel.kmpgrpc.core.rpc.rpcImplementation$rpcFlow$1.rpcImplementation$rpcFlow$1$invoke$waitForDoneJob$1.$invokeCOROUTINE$3.invokeSuspend#internal + 1127 
    at 5   myapp.debug.dylib      0x10cd69ae7        kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#invokeSuspend(kotlin.Result<kotlin.Any?>){}kotlin.Any?-trampoline + 67 
    at 6   myapp.debug.dylib      0x10cc221cf        kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 691 
    at 7   myapp.debug.dylib      0x10cd69bc7        kfun:kotlin.coroutines.Continuation#resumeWith(kotlin.Result<1:0>){}-trampoline + 99 
    at 8   myapp.debug.dylib      0x10cea0f4f        kfun:kotlinx.coroutines.DispatchedTask#run(){} + 2039 
    at 9   myapp.debug.dylib      0x10ced241f        kfun:kotlinx.coroutines.Runnable#run(){}-trampoline + 91 
    at 10  myapp.debug.dylib      0x10cec9c53        kfun:kotlinx.coroutines.MultiWorkerDispatcher.MultiWorkerDispatcher$workerRunLoop$1.$invokeCOROUTINE$0.invokeSuspend#internal + 2363 
    at 11  myapp.debug.dylib      0x10cd69ae7        kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#invokeSuspend(kotlin.Result<kotlin.Any?>){}kotlin.Any?-trampoline + 67 
    at 12  myapp.debug.dylib      0x10cc221cf        kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 691 
    at 13  myapp.debug.dylib      0x10cd69bc7        kfun:kotlin.coroutines.Continuation#resumeWith(kotlin.Result<1:0>){}-trampoline + 99 
    at 14  myapp.debug.dylib      0x10cea0f4f        kfun:kotlinx.coroutines.DispatchedTask#run(){} + 2039 
    at 15  myapp.debug.dylib      0x10ced241f        kfun:kotlinx.coroutines.Runnable#run(){}-trampoline + 91 
    at 16  myapp.debug.dylib      0x10ce28443        kfun:kotlinx.coroutines.EventLoopImplBase#processNextEvent(){}kotlin.Long + 287 
    at 17  myapp.debug.dylib      0x10ced2197        kfun:kotlinx.coroutines.EventLoop#processNextEvent(){}kotlin.Long-trampoline + 51 
    at 18  myapp.debug.dylib      0x10cec24ef        kfun:kotlinx.coroutines.BlockingCoroutine.joinBlocking#internal + 455 
    at 19  myapp.debug.dylib      0x10cec12ff        kfun:kotlinx.coroutines#runBlocking(kotlin.coroutines.CoroutineContext;kotlin.coroutines.SuspendFunction1<kotlinx.coroutines.CoroutineScope,0:0>){0§<kotlin.Any?>}0:0 + 1487 
    at 20  myapp.debug.dylib      0x10cec14df        kfun:kotlinx.coroutines#runBlocking$default(kotlin.coroutines.CoroutineContext?;kotlin.coroutines.SuspendFunction1<kotlinx.coroutines.CoroutineScope,0:0>;kotlin.Int){0§<kotlin.Any?>}0:0 + 239 
    at 21  myapp.debug.dylib      0x10cec75ff        kfun:kotlinx.coroutines.MultiWorkerDispatcher.workerRunLoop#internal + 195 
    at 22  myapp.debug.dylib      0x10cec9083        kfun:kotlinx.coroutines.MultiWorkerDispatcher.MultiWorkerDispatcher$1.MultiWorkerDispatcher$1$invoke$$inlined$apply$1.invoke#internal + 71 
    at 23  myapp.debug.dylib      0x10cec90df        kfun:kotlinx.coroutines.MultiWorkerDispatcher.MultiWorkerDispatcher$1.MultiWorkerDispatcher$1$invoke$$inlined$apply$1.$<bridge-DN>invoke(){}#internal + 71 
    at 24  myapp.debug.dylib      0x10cd672f3        kfun:kotlin.Function0#invoke(){}1:0-trampoline + 99 
    at 25  myapp.debug.dylib      0x10cc2f59b        WorkerExecuteAfterLaunchpad + 271 
    at 26  myapp.debug.dylib      0x10cdc9edb        _ZN6Worker19processQueueElementEb + 3247 
    at 27  myapp.debug.dylib      0x10cdc90b7        _ZN12_GLOBAL__N_113workerRoutineEPv + 251 
    at 28  libsystem_pthread.dylib             0x21ba17343        _pthread_start + 135 
    at 29  libsystem_pthread.dylib             0x21ba14ab7        thread_start + 7 

07-27 16:27:33.808 ❤️ ERROR Napier.e - gRPC StatusException details - Code: UNKNOWN, Description: h2 protocol error: http2 error, Cause: No cause
07-27 16:27:33.843 ❤️ ERROR Napier.e - Failed to validate access code
kotlin.Exception: Network connection failed. Please check your internet connection and try again.
    at 0   myapp.debug.dylib      0x10cc1bddf        kfun:kotlin.Throwable#<init>(kotlin.String?){} + 99 
    at 1   myapp.debug.dylib      0x10cc15a9f        kfun:kotlin.Exception#<init>(kotlin.String?){} + 95 
    at 2   myapp.debug.dylib      0x10c3ab793        kfun:com.myapp.app.shared.utility.GrpcUtility.Companion#handleException(kotlin.Exception;kotlin.String){}kotlin.Exception + 1987 
    at 3   myapp.debug.dylib      0x10c393bef        kfun:com.myapp.app.shared.services.grpc.auth.AuthService.AuthService$validateAccessCode$2.$invokeCOROUTINE$0.invokeSuspend#internal + 1207 
    at 4   myapp.debug.dylib      0x10cd69ae7        kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#invokeSuspend(kotlin.Result<kotlin.Any?>){}kotlin.Any?-trampoline + 67 
    at 5   myapp.debug.dylib      0x10cc221cf        kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 691 
    at 6   myapp.debug.dylib      0x10cd69bc7        kfun:kotlin.coroutines.Continuation#resumeWith(kotlin.Result<1:0>){}-trampoline + 99 
    at 7   myapp.debug.dylib      0x10cea0e53        kfun:kotlinx.coroutines.DispatchedTask#run(){} + 1787 
    at 8   myapp.debug.dylib      0x10ced241f        kfun:kotlinx.coroutines.Runnable#run(){}-trampoline + 91 
    at 9   myapp.debug.dylib      0x10cea3fef        kfun:kotlinx.coroutines.internal.LimitedDispatcher.Worker.run#internal + 359 
    at 10  myapp.debug.dylib      0x10ced241f        kfun:kotlinx.coroutines.Runnable#run(){}-trampoline + 91 
    at 11  myapp.debug.dylib      0x10cec9c53        kfun:kotlinx.coroutines.MultiWorkerDispatcher.MultiWorkerDispatcher$workerRunLoop$1.$invokeCOROUTINE$0.invokeSuspend#internal + 2363 
    at 12  myapp.debug.dylib      0x10cd69ae7        kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#invokeSuspend(kotlin.Result<kotlin.Any?>){}kotlin.Any?-trampoline + 67 
    at 13  myapp.debug.dylib      0x10cc221cf        kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 691 
    at 14  myapp.debug.dylib      0x10cd69bc7        kfun:kotlin.coroutines.Continuation#resumeWith(kotlin.Result<1:0>){}-trampoline + 99 
    at 15  myapp.debug.dylib      0x10cea0f4f        kfun:kotlinx.coroutines.DispatchedTask#run(){} + 2039 
    at 16  myapp.debug.dylib      0x10ced241f        kfun:kotlinx.coroutines.Runnable#run(){}-trampoline + 91 
    at 17  myapp.debug.dylib      0x10ce28443        kfun:kotlinx.coroutines.EventLoopImplBase#processNextEvent(){}kotlin.Long + 287 
    at 18  myapp.debug.dylib      0x10ced2197        kfun:kotlinx.coroutines.EventLoop#processNextEvent(){}kotlin.Long-trampoline + 51 
    at 19  myapp.debug.dylib      0x10cec24ef        kfun:kotlinx.coroutines.BlockingCoroutine.joinBlocking#internal + 455 
    at 20  myapp.debug.dylib      0x10cec12ff        kfun:kotlinx.coroutines#runBlocking(kotlin.coroutines.CoroutineContext;kotlin.coroutines.SuspendFunction1<kotlinx.coroutines.CoroutineScope,0:0>){0§<kotlin.Any?>}0:0 + 1487 
    at 21  myapp.debug.dylib      0x10cec14df        kfun:kotlinx.coroutines#runBlocking$default(kotlin.coroutines.CoroutineContext?;kotlin.coroutines.SuspendFunction1<kotlinx.coroutines.CoroutineScope,0:0>;kotlin.Int){0§<kotlin.Any?>}0:0 + 239 
    at 22  myapp.debug.dylib      0x10cec75ff        kfun:kotlinx.coroutines.MultiWorkerDispatcher.workerRunLoop#internal + 195 
    at 23  myapp.debug.dylib      0x10cec9083        kfun:kotlinx.coroutines.MultiWorkerDispatcher.MultiWorkerDispatcher$1.MultiWorkerDispatcher$1$invoke$$inlined$apply$1.invoke#internal + 71 
    at 24  myapp.debug.dylib      0x10cec90df        kfun:kotlinx.coroutines.MultiWorkerDispatcher.MultiWorkerDispatcher$1.MultiWorkerDispatcher$1$invoke$$inlined$apply$1.$<bridge-DN>invoke(){}#internal + 71 
    at 25  myapp.debug.dylib      0x10cd672f3        kfun:kotlin.Function0#invoke(){}1:0-trampoline + 99 
    at 26  myapp.debug.dylib      0x10cc2f59b        WorkerExecuteAfterLaunchpad + 271 
    at 27  myapp.debug.dylib      0x10cdc9edb        _ZN6Worker19processQueueElementEb + 3247 
    at 28  myapp.debug.dylib      0x10cdc90b7        _ZN12_GLOBAL__N_113workerRoutineEPv + 251 
    at 29  libsystem_pthread.dylib             0x21ba17343        _pthread_start + 135 
    at 30  libsystem_pthread.dylib             0x21ba14ab7        thread_start + 7 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions