Issue with 0.3.0-beta / Kotlin 1.3
jmarinelli opened this issue · comments
Hi! i'm having this weird issue trying to implement KGrapQL 0.3.0-beta using Kotlin's new release 1.3
I'm defining this schema:
val schema = KGraphQL.schema {
configure {
useDefaultPrettyPrinter = true
}
query("user") {
description = "Returns a user by its phone number"
resolver { phoneNumber: String ->
userService.getByPhoneNumber(phoneNumber)
}
}
}
And when executing the following code:
val result = schema.execute("{user(phoneNumber:\"005491140632747\"){firstName}}")
I get the following stacktrace:
java.lang.NoSuchMethodError: kotlinx.coroutines.BuildersKt.launch$default(Lkotlin/coroutines/CoroutineContext;Lkotlinx/coroutines/CoroutineStart;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
at com.github.pgutkowski.kgraphql.schema.execution.ParallelRequestExecutor.suspendExecute(ParallelRequestExecutor.kt:53)
at com.github.pgutkowski.kgraphql.schema.execution.ParallelRequestExecutor$execute$1.invokeSuspend(ParallelRequestExecutor.kt:89)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:32)
at kotlinx.coroutines.DispatchedTask$DefaultImpls.run(Dispatched.kt:235)
at kotlinx.coroutines.DispatchedContinuation.run(Dispatched.kt:81)
at kotlinx.coroutines.EventLoopBase.processNextEvent(EventLoop.kt:123)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:69)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:45)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:35)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at com.github.pgutkowski.kgraphql.schema.execution.ParallelRequestExecutor.execute(ParallelRequestExecutor.kt:88)
at com.github.pgutkowski.kgraphql.schema.DefaultSchema.execute(DefaultSchema.kt:54)
at com.github.pgutkowski.kgraphql.schema.Schema$DefaultImpls.execute$default(Schema.kt:8)
at com.benkopay.user.UserGraphQLRoutesKt$graphql$1.invokeSuspend(UserGraphQLRoutes.kt:34)
at com.benkopay.user.UserGraphQLRoutesKt$graphql$1.invoke(UserGraphQLRoutes.kt)
at io.ktor.util.pipeline.PipelineContext.proceed(PipelineContext.kt:53)
at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:24)
at io.ktor.routing.Routing.executeResult(Routing.kt:110)
at io.ktor.routing.Routing.interceptor(Routing.kt:29)
at io.ktor.routing.Routing$Feature$install$1.invokeSuspend(Routing.kt:75)
at io.ktor.routing.Routing$Feature$install$1.invoke(Routing.kt)
at io.ktor.util.pipeline.PipelineContext.proceed(PipelineContext.kt:53)
at io.ktor.features.ContentNegotiation$Feature$install$1.invokeSuspend(ContentNegotiation.kt:60)
at io.ktor.features.ContentNegotiation$Feature$install$1.invoke(ContentNegotiation.kt)
at io.ktor.util.pipeline.PipelineContext.proceed(PipelineContext.kt:53)
at io.ktor.features.StatusPages$intercept$3.invokeSuspend(StatusPages.kt:88)
at io.ktor.features.StatusPages$intercept$3.invoke(StatusPages.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:82)
at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:162)
at io.ktor.features.StatusPages.intercept(StatusPages.kt:87)
at io.ktor.features.StatusPages$Feature$install$1.invokeSuspend(StatusPages.kt:121)
at io.ktor.features.StatusPages$Feature$install$1.invoke(StatusPages.kt)
at io.ktor.util.pipeline.PipelineContext.proceed(PipelineContext.kt:53)
at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:24)
at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invokeSuspend(DefaultEnginePipeline.kt:80)
at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invoke(DefaultEnginePipeline.kt)
at io.ktor.util.pipeline.PipelineContext.proceed(PipelineContext.kt:53)
at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:24)
at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invokeSuspend(NettyApplicationCallHandler.kt:31)
at io.ktor.server.netty.NettyApplicationCallHandler$handleRequest$1.invoke(NettyApplicationCallHandler.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:54)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:111)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:160)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:54)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
at io.ktor.server.netty.NettyApplicationCallHandler.handleRequest(NettyApplicationCallHandler.kt:22)
at io.ktor.server.netty.NettyApplicationCallHandler.channelRead(NettyApplicationCallHandler.kt:16)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:38)
at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:353)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
gradle.properties:
logback_version=1.2.1
ktor_version=1.0.0-beta-3
kotlin.code.style=official
kotlin_version=1.3.0
kgraphql_version=0.3.0-beta
build.gradle:
buildscript {
repositories {
jcenter()
maven { url 'https://kotlin.bintray.com/kotlin-eap' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'kotlin'
apply plugin: 'application'
group 'poc-api'
version '0.0.1-SNAPSHOT'
mainClassName = "io.ktor.server.netty.EngineMain"
sourceSets {
main.kotlin.srcDirs = main.java.srcDirs = ['src']
test.kotlin.srcDirs = test.java.srcDirs = ['test']
main.resources.srcDirs = ['resources']
test.resources.srcDirs = ['testresources']
}
repositories {
mavenLocal()
jcenter()
maven { url 'https://kotlin.bintray.com/ktor' }
maven { url 'https://kotlin.bintray.com/kotlin-eap' }
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile "io.ktor:ktor-server-netty:$ktor_version"
compile "ch.qos.logback:logback-classic:$logback_version"
compile "io.ktor:ktor-server-core:$ktor_version"
compile "io.ktor:ktor-auth:$ktor_version"
compile "io.ktor:ktor-auth-jwt:$ktor_version"
compile "io.ktor:ktor-locations:$ktor_version"
compile "io.ktor:ktor-server-host-common:$ktor_version"
compile "io.ktor:ktor-gson:$ktor_version"
compile 'org.koin:koin-ktor:1.0.1'
compile "com.github.pgutkowski:kgraphql:$kgraphql_version"
compile group: "org.mindrot", name: "jbcrypt", version: "0.4"
compile 'org.jetbrains.exposed:exposed:0.11.1'
compile "org.postgresql:postgresql:42.2.2"
compile 'com.zaxxer:HikariCP:2.7.8'
testCompile "io.ktor:ktor-server-tests:$ktor_version"
}
Of course I tried cleaning, re-building, with new projects, etc.
I'm kind of new with kotlin, so I do know if the coroutines API had big changes since the 1.3 release and RCs, but it feels like it might have something to do with that.
Thank you!
On it, expect a pull-request shortly
I've created a pull request #33 that takes care of those issues.
@jmarinelli Addressed by #33 and merged, I've released new version: 0.3.0. Please upgrade.
Thanks! Great library btw!