https://kotlinlang.org logo
Title
t

tim

04/12/2022, 4:06 PM
Hello i’m encountering an error when running
graphqlIntrospectSchema
in the 6.0.0-alpha.0 version. I’ve started my gql server and then i’m running
./gradlew graphqlIntrospectSchema --endpoint="<http://localhost:12017/api/public/graphql>"<http://localhost:12017/api/public/graphql>
but this is failing with the following exception:
Execution failed for task ':graphqlIntrospectSchema'.
> There was a failure while executing work items
   > A failure occurred while executing com.expediagroup.graphql.plugin.gradle.actions.IntrospectSchemaAction
      > Unable to run introspection query against the specified endpoint=<http://localhost:12017/api/public/graphql>
No transformation found: class io.ktor.utils.io.ByteBufferChannel -> class kotlin.collections.Map
with response from <http://localhost:12017/api/public/graphql>:
status: 200 OK
response headers: 
Vary: Origin
, Content-Length: 34557
, Content-Type: text/plain; charset=UTF-8
, Connection: keep-alive
Any suggestions on what I’m doing wrong?
d

Dariusz Kuc

04/12/2022, 4:24 PM
hello 👋 this sounds like a potential classpath issue. If you could open an issue and provide a repo that reproduces that issue it would be great. side note: I got an open PR that bumps up ktor dependency to 2.0 (another alpha will be cut once the batching and dep update PRs are merged) which may fix the issue
🙏 1
t

tim

04/12/2022, 5:24 PM
signing off for fit the night, but will create a repo tomorrow
👍 1
v

vio

04/19/2022, 4:54 PM
Hi 👋 sorry I'm coming back to this a bit later. I've created a repo that reproduces this error, using version
6.0.0-alpha.1
, and added the full logs in an issue: here
d

Dariusz Kuc

04/19/2022, 10:42 PM
👋 Thanks for the code example but I don't think it reproduces your issue -> in your example project you have misconfigured
graphql-kotlin
plugin Since you are configuring
graphql { client { .... }}
it will attempt to add corresponding tasks as a compile dependency. When you attempt to build/run your app it attempts to run introspection against
localhost:8080/graphql
which at that point in time does not exist yet - hence the
Unable to run introspection query against the specified endpoint=<http://localhost:8080/graphql>
your original issue complains about missing serialization logic to map from byte buffer to a map
this sounds like a similar issue -> https://youtrack.jetbrains.com/issue/KTOR-1343 try setting up content type explicitly on the response
v

vio

04/21/2022, 12:28 PM
Sorry about mixing those things up. Thanks for your explanation, makes sense and it clarified things for me. Setting up
content type
on the response fixed the introspection issue:
call.respondText(jsonString, ContentType.Application.Json)
and after I had the schema and added the graphql queries to
resources
, I managed to get the graphql plugin to generate the files. I've pushed the fix to that repo as well. Thank you very much 🙏
d

Dariusz Kuc

04/21/2022, 1:29 PM
awesome 👍