https://kotlinlang.org logo
Join Slack
Powered by
# ktor
  • s

    suyash

    10/10/2025, 1:28 PM
    I have deployed my ktor server on Render using exposed I set up my database and using a json file to parse some fake records
    c
    • 2
    • 7
  • r

    reactormonk

    10/10/2025, 4:11 PM
    I've got the situation that my ktor http client doens't fall back onto ipv4 after the ipv6 connection just times out, is there a specific setting for that?
    a
    • 2
    • 2
  • f

    Fedor Erofeev

    10/11/2025, 9:06 AM
    OpenAPI tags seem to be not working in 3.3.0, is anyone facing this issue? Update: have to specify it as e.g.
    @tag users
    if someone having troubles, seems KLIP has some wrong sample
    h
    a
    b
    • 4
    • 5
  • r

    Robert Jaros

    10/13/2025, 5:27 PM
    When deploying my Ktor app to production (running a fat jar) I have an error about generating swagger supporting file. More in thread.
    a
    • 2
    • 4
  • b

    Bernhard

    10/14/2025, 1:33 PM
    Ktor Client: Is there anything built in that generates an HMAC over the request body and allows you to set the value as a header? I found StatelessHmacNonceManager but at least my understanding is that while it generates an HMAC, it's not generated over the request body
    ✅ 1
    a
    • 2
    • 3
  • b

    Bernhard

    10/16/2025, 11:28 AM
    is Ktor server a good choice when the code should potentially run on something serverless like AWS lambda? I know that at least Spring's overhead is probably too high; main concerns are startup time and not having to deal with reflection/annotations should GraalVM be used
    ✅ 1
    m
    s
    • 3
    • 3
  • c

    Cherrio LLC

    10/16/2025, 12:15 PM
    When working with sockets. Is there a way to reactively know when there's a disconnection without polling? Or I'll have to poll?
    a
    • 2
    • 1
  • b

    Bernhard

    10/16/2025, 12:47 PM
    when using Ktor client, is there a way to intercept a single request when making the call? https://ktor.io/docs/client-http-send.html looks like it'll intercept all calls on that client instance; I need to compute a signature over the request body and set it as a header for a single request
    ✅ 1
    j
    p
    • 3
    • 6
  • a

    Abthul Razeeth

    10/19/2025, 6:53 AM
    Hi, I have a ktor setup with JWT authentication, and i have my own version of RSA algorithm overriding sign and verify. When minify is enabled in android project, RSA algorithm's sign is called, but not the verify. It works fine when minify is disabled. I have added --keep for all the related classes in proguard, but still it doesn't work. When the api is hit, Unauthorized 401 is returned. any idea?
    a
    • 2
    • 3
  • a

    Abthul Razeeth

    10/19/2025, 6:57 AM
    I am using ktor 2.3.0
  • s

    suresh

    10/20/2025, 6:56 AM
    Does Ktor support the new
    webMain
    shared target (https://kotlinlang.org/docs/whatsnew2220.html#shared-source-set-for-js-and-wasmjs-targets)? The Ktor JS client engine is not getting resolved on the webMain sourceset.
    a
    • 2
    • 2
  • r

    Ryuhei Furuta

    10/20/2025, 11:33 AM
    Hi! Thanks for maintaining Ktor 🙌 When building a fat JAR with
    ktor-server-config-yaml
    on the classpath, we observed that YamlConfigLoader gets selected and application.conf is not loaded. (It took several hours to solve this problem...) This looks related to how
    META-INF/services
    files are merged for a fat JAR and how JVM ServiceLoader resolves providers, rather than a Ktor-specific bug. I saw some issues referencing this behavior like • https://youtrack.jetbrains.com/issue/KTOR-6610/Log-which-ConfigLoader-has-been-used-for-loading-the-server-configuration • https://kotlinlang.slack.com/archives/C0A974TJ9/p1736451975122839 As Patrik Csikós says in YouTrack issue comment, I thought it would be beneficial to take these actions below. (A) Improve logging: when multiple ConfigLoaders are discovered, log the list of candidates and the reason one was selected. (B) Document the behavior when including multiple ConfigLoader on the classpath. If this direction makes sense, I'd be happy to open a PR for (A) logging and/or (B) docs. Would appreciate guidance on the preferred approach. Thank you!
    a
    • 2
    • 3
  • r

    ryanbreaker

    10/21/2025, 4:24 PM
    @Jeff Hudson Heya, I was just wondering why the
    withMdc
    function was removed from Kairo in v6, or was it just moved somewhere else? https://github.com/hudson155/kairo/blob/v5.15.1/kairo-mdc/src/main/kotlin/kairo/mdc/withMdc.kt
    j
    • 2
    • 14
  • s

    Sangeeta

    10/26/2025, 10:28 AM
    Hi Team, I am using the following environment for my project: • Kotlin: 2.2.20 • Ktor: 3.3.1 I am generating OpenAPI specifications using
    ./gradlew buildOpenApi
    . I noticed a couple of things: 1. The
    @description
    annotation in KDoc (as documented here) does not appear in the generated OpenAPI output. It seems the description is ignored, while the first line of the KDoc becomes the summary. 2. The OpenAPI spec currently includes internal endpoints (e.g.,
    /json/kotlinx-serialization
    ). Is there a way/annotation to exclude such endpoints from the generated spec? 3. Is there any support or recommended approach for nested tags? Currently, only flat tag grouping is supported. Thanks in advance for the guidance!
    b
    • 2
    • 8
  • a

    Anders

    10/28/2025, 9:36 AM
    When i run many parallell tests with ktor testApplication i always hit the 10 second timeout on some tests no matter what i configure. I use junit 5, anyone else had this problem?
    a
    • 2
    • 15
  • f

    Florian

    10/30/2025, 7:09 PM
    Hi, I am looking at https://ktor.io/docs/server-request-validation.html and wondering, whether I should install RequestValidation for every route? The Docs just say it can be installed multiple times, but would that be recommended? How should I handle it if I need different validation for e.g.
    GET /users/{id}
    ,
    PUT /users/{id}
    ,
    GET /users/
    ?
    a
    a
    • 3
    • 2
  • h

    Hong Phuc

    11/02/2025, 7:26 AM
    Hi everyone, I'm seeing this weird behaviour with ktor-jetty server where when running the code via the commandline, the program log doesn't include any thread name that belong to the jetty server, here is an example:
    Copy code
    Nov 02 06:53:48 backend-server java[675013]: Routing resolve result:
    Nov 02 06:53:48 backend-server java[675013]:   SUCCESS @ /api/posts/(method:POST)
    Nov 02 06:53:48 backend-server java[675013]: This is session null
    Nov 02 06:53:48 backend-server java[675013]: 2025-11-02 06:53:48.248 [eventLoopGroupProxy-4-2] TRACE i.k.server.engine.DefaultTransform - Transformed class io.ktor.utils.io.ByteChannel to class io.ktor.http.cio.CIOMultipartDataBase for /api/pos>
    Nov 02 06:53:48 backend-server java[675013]: 2025-11-02 06:53:48.249 [eventLoopGroupProxy-4-2] ERROR Application - Unhandled: POST - /api/posts
    Nov 02 06:53:48 backend-server java[675013]: java.lang.NullPointerException: null
    Nov 02 06:53:48 backend-server java[675013]:         at com.yourart.RoutingKt$configureRouting$1$5.invokeSuspend(Routing.kt:155)
    Nov 02 06:53:48 backend-server java[675013]:         at com.yourart.RoutingKt$configureRouting$1$5.invoke(Routing.kt)
    Nov 02 06:53:48 backend-server java[675013]:         at com.yourart.RoutingKt$configureRouting$1$5.invoke(Routing.kt)
    Nov 02 06:53:48 backend-server java[675013]:         at io.ktor.server.routing.RoutingNode$buildPipeline$1$1.invokeSuspend(RoutingNode.kt:126)
    Nov 02 06:53:48 backend-server java[675013]:         at io.ktor.server.routing.RoutingNode$buildPipeline$1$1.invoke(RoutingNode.kt)
    This is when I'm running the code locally via Intellij:
    Copy code
    Routing resolve result:
      SUCCESS @ /api/posts/(method:POST)
    This is session null
    2025-11-02 18:29:27.989 [ktor-jetty-8000-1] TRACE i.k.server.engine.DefaultTransform - Transformed class io.ktor.utils.io.ByteChannel to class io.ktor.http.cio.CIOMultipartDataBase for /api/posts
    2025-11-02 18:29:28.026 [ktor-jetty-8000-3] TRACE a.s.k.r.h.operation.OperationHandler - operation started
    2025-11-02 18:29:28.053 [ktor-jetty-8000-4] DEBUG a.s.k.r.a.c.ProfileCredentialsProvider - Loading credentials from profile `default`
    2025-11-02 18:29:28.062 [ktor-jetty-8000-4] DEBUG a.s.k.r.a.c.ProfileCredentialsProvider - Resolving credentials from static credentials
    Does anyone know why this is the case? Thanks in advance
    a
    • 2
    • 1
  • h

    Hong Phuc

    11/02/2025, 7:42 AM
    Also, I happened to ran into this error as well, does anyone know what the part where it said
    Concurrent read attempts
    mean? I'm trying to read a file in this function where this error happened.
    Copy code
    2025-11-02 07:39:59.407 [eventLoopGroupProxy-4-3] ERROR Application - Unhandled exception caught for CoroutineName(call-handler)
    Nov 02 07:39:59 backend-server java[675297]: io.ktor.utils.io.ConcurrentIOException: Concurrent read attempts
    Nov 02 07:39:59 backend-server java[675297]:         at io.ktor.utils.io.ByteChannel.awaitContent(ByteChannel.kt:272)
    Nov 02 07:39:59 backend-server java[675297]:         at io.ktor.utils.io.ByteReadChannel$DefaultImpls.awaitContent$default(ByteReadChannel.kt:30)
    Nov 02 07:39:59 backend-server java[675297]:         at io.ktor.utils.io.ByteReadChannelOperationsKt.discard(ByteReadChannelOperations.kt:349)
    Nov 02 07:39:59 backend-server java[675297]:         at io.ktor.utils.io.ByteReadChannelOperationsKt.discard$default(ByteReadChannelOperations.kt:344)
    Nov 02 07:39:59 backend-server java[675297]:         at io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$1.invokeSuspend(DefaultEnginePipeline.kt:42)
    Nov 02 07:39:59 backend-server java[675297]:         at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    Nov 02 07:39:59 backend-server java[675297]:         at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:99)
    Nov 02 07:39:59 backend-server java[675297]:         at kotlinx.coroutines.EventLoop.processUnconfinedEvent(EventLoop.common.kt:65)
    Nov 02 07:39:59 backend-server java[675297]:         at kotlinx.coroutines.internal.DispatchedContinuation.resumeWith(DispatchedContinuation.kt:327)
    Nov 02 07:39:59 backend-server java[675297]:         at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:149)
    Nov 02 07:39:59 backend-server java[675297]:         at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:134)
    Nov 02 07:39:59 backend-server java[675297]:         at io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:89)
    Nov 02 07:39:59 backend-server java[675297]:         at io.ktor.util.pipeline.SuspendFunctionGun.execute$ktor_utils(SuspendFunctionGun.kt:109)
    Nov 02 07:39:59 backend-server java[675297]:         at io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:86)
    Nov 02 07:39:59 backend-server java[675297]:         at
    a
    • 2
    • 6
  • z

    Zyle Moore

    11/02/2025, 10:41 PM
    How can I configure Ktor to use a custom serializers module during content negotiation, specifically for a polymorphic type? Something simple like
    Copy code
    val serializerModule = SerializersModule {
        polymorphic(Person::class) {
            subclass(SerializablePerson::class)
        }
    }
    r
    • 2
    • 3
  • s

    suresh

    11/04/2025, 12:37 AM
    I am using Ktor 3.3.1 with the
    Jetty engine
    . Calling
    call.request.servletRequestAttributes
    from the call interceptor throws the following error. Any idea why it’s not set for the Jetty engine?
    a
    • 2
    • 9
  • h

    Horatio Thomas

    11/05/2025, 6:49 AM
    Any sample apps using DI yet: https://ktor.io/docs/server-dependency-injection.html?topic=rx?
    a
    • 2
    • 2
  • h

    Horatio Thomas

    11/05/2025, 9:11 AM
    Was checking out the ktor chat project and just realized, you can do this. Pretty cool. Overall the ktor chat project is very elegant. I have some refactoring to do.
  • s

    suresh

    11/06/2025, 2:40 AM
    Is there any way to configure multiple connectors in the HOCON file (including the sslConnector) ?
    a
    • 2
    • 1
  • a

    Alina Dolgikh [JB]

    11/06/2025, 10:05 AM
    📣 The Ktor Annual Survey is live and we’d love your feedback! Whether you’ve built production systems with it or are just experimenting, your input will help us make Ktor better for everyone. Share your experience with its features, documentation, and tools. ktor new* *Take the survey: https://surveys.jetbrains.com/s3/4c0c162c2785
    ktor new 6
  • r

    Ryan Woodcock

    11/06/2025, 7:15 PM
    Hey, i'm getting a strange error with Ktor 3.3.2 and Kotlin 2.2.21 when using the wasmJs HttpClient: ReferenceError: process is not defined at io.ktor.util.logging.getKtorLogLevel This is happening when I try to use the Auth plugin, since it calls the KtorSimpleLogger. When I read the source it says its running catching but apparently I'm still getting the ReferenceError
    a
    • 2
    • 2
  • s

    suresh

    11/07/2025, 12:14 AM
    Hi @Bruce Hamilton Regarding the new OpenAPI spec generation, I’m encountering a few issues:
    b
    • 2
    • 3
  • a

    Arjan van Wieringen

    11/07/2025, 6:56 AM
    Here is a silly question.... can Ktor Server be made into a more generic (server) application runtime? I really like the way Ktor is configurable and extendable and a lot of things aren't necessarily HTTP-server related: config management, application parameters, DI, plugins, App lifecycle events. In that sense the http-server can also be a plugin? Out of the box Ktor has some pretty nice ways of setting up and configuring your app. The reason I was thinking about this is that I was adding a simple kafka consumer in my app using a plugin and the plugin system and DI made that very ergonomic:
    Copy code
    fun Application.module(myService: MyService) {
        subscribe(topic = "my-topic", autoOffsetReset = Latest) {
             on<UserRegistered> { event ->
                myService.userHasRegistered(event.user)
             }
        }
    }
    No need for HTTP (although I use it for liveness and readyness probe) but I use al the Ktor app features
    👍 1
    b
    r
    a
    • 4
    • 6
  • c

    chrisjenx

    11/07/2025, 9:04 PM
    Anyone else noticed that the Ktor plugin in Intellij has been broken for ages?
    j
    • 2
    • 6
  • v

    Vivek Modi

    11/08/2025, 7:47 AM
    Hey does ktor work with grpc? If yes which client does it support?
    b
    • 2
    • 3
  • h

    Hristijan

    11/09/2025, 12:48 PM
    hey guys, i am having some issue with the CORS plugin, this is my code check 🧵 when i curl the url i do not see the allow methods i’ve added
    a
    • 2
    • 13