https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
ktor
  • s

    Sandeep Chandra

    04/25/2021, 12:20 AM
    The Ktor plugin for IntelliJ is marked as Obsolete, is there a current one? There is this but it looks like it is only for Ultimate edition.
    r
    r
    • 3
    • 3
  • h

    Helio

    04/25/2021, 3:13 AM
    Hello 👋🏽 I’ve gotta a question here which I’m not entirely sure if it relates with Coroutines or Ktor. Apologies if this is the wrong channel. Well, I’ve recently updated Kotlin  
    1.4.10 -> 1.4.32
     and Ktor 
    1.4.2 -> 1.5.3
     . I was definitely expecting some of Unit tests to break due to compatibility and I’ve already fixed them. However, there are still 4 of them that I’m struggling to understand what could be wrong. When one of the unit tests starts, it adds an entity to a Global Variable with type 
    mutableListOf<MyModel>()
    . I can confirm that the value was added successfully.  
    ArrayList@XXXX
    . However, when one of the routes of my Ktor server attempt to read the value from that Global Variable, it is empty and the id of the object is now 
    ArrayList@YYYY
    . It looks like when 
    embeddedServer(…).start()
     is executed, it creates a new instance of the Global Object, hence it is empty. I’ve already tried many things, SynchronizeListOf, add the global variable into an object, but no matter what I do the reference of the GlobalObject into Ktor is always different. Would anyone be able to shed some light, please? Thanks heaps.
    • 1
    • 1
  • t

    Tim Malseed

    04/25/2021, 4:31 AM
    I've got a bit of a dumb question.. Using dagger for DI in Ktor. Where do I @Inject all my things?
    j
    c
    • 3
    • 7
  • s

    Satyam Agarwal

    04/26/2021, 8:14 AM
    Hei Ktor team! Can we please prioritize this ? https://youtrack.jetbrains.com/issue/KTOR-1973 This affects our applications often.
    ➕ 1
    h
    • 2
    • 2
  • v

    vio

    04/26/2021, 1:58 PM
    hi all, I've came across this issue with the server I have, and I get an exception about
    ClosedWatchServiceException
    , when running multiple tests all together. I'm using ktor:
    1.5.2
    , and having a
    jetty
    server. The issue is thrown when the server is restarted in following tests. here's a code snippet to exemplify the error:
    class StartStopServerTest : FreeSpec({  
        "server" - {
            val server = embeddedServer(
                factory = Jetty,
                port = 8080,
                module = {}
            )
    
            "start" {
                server.start()
            }
    
            "stop" {
                server.stop(1000, 1000)
            }
    
            "restart" {
                server.start()  // this fails with the error as shown in the picture
            }
    
            "stop again" {
                server.stop(1000, 1000)
            }
        }
    })
    Did anybody face this as well? Appreciate any suggestions and help, thank you 🙏
    • 1
    • 2
  • g

    Guilherme Delgado

    04/26/2021, 4:38 PM
    Hello, I’ve a few questions regarding authentication with Google oAuth. I’m developing a Server and a webApp. For now the Server acts like a proxy between webApp and a Google API (down the road I’ll add some custom logic to justify the existence of the SS, but for now existis for the purpose of the exercise). The idea is: - webApp has a few .ftl pages and respective Routing Locations. One of this .ftl needs authentication (to fetch data from Google Api through Server) - Server communicates with Google API using the AccessToken provided by Google OAuth to the webApp This is my configuration: Application.kt
    install(Sessions) {
        cookie<Session>(SESSION_COOKIE) {
            cookie.extensions["SameSite"] = "lax"
            transform(SessionTransportTransformerMessageAuthentication(hex(...)))
        }
    }
    install(Authentication) {
        session<Session>(SESSION_AUTH) {
            challenge { throw AuthenticationException() }
            validate { session -> if (session.accessToken.isEmpty()) null else session }
        }
        oauth(GOOGLE_OAUTH) {
            client = httpClient
            providerLookup = {
                OAuthServerSettings.OAuth2ServerSettings(
                    name = "google",
                    authorizeUrl = "<https://accounts.google.com/o/oauth2/auth>",
                    accessTokenUrl = "<https://www.googleapis.com/oauth2/v3/token>",
                    requestMethod = <http://HttpMethod.Post|HttpMethod.Post>,
                    ...
                )
            }
            urlProvider = { p -> redirectUrl(Login(p.name), false) }
        }
    }
    webApp/Auth.kt
    @KtorExperimentalLocationsAPI
    @Location("/login/{provider?}")
    class Login(val provider: String = "google")
    
    @KtorExperimentalLocationsAPI
    fun Route.login(client: HttpClient) {
        authenticate(GOOGLE_OAUTH) {
            location<Login> {
                param("error") { handle {...} }
                handle {
                    val principal = call.authentication.principal<OAuthAccessTokenResponse>()
                    if (principal != null) {
                        val oauth = call.authentication.principal<OAuthAccessTokenResponse.OAuth2>()!!
                        val response = client.get<UserInfo>("<https://www.googleapis.com/oauth2/v1/userinfo>") {
                            header(HttpHeaders.Authorization, "Bearer ${oauth.accessToken}")
                        }
                        call.sessions.set(Session(response, oauth.accessToken, oauth.refreshToken?: ""))
                        call.redirect(Home())
                    } else {
                        call.respond(status = HttpStatusCode.Unauthorized, "Unauthorized, no token issued")
                    }
                }
            }
        }
    }
    webApp/Data.kt
    @KtorExperimentalLocationsAPI
    @Location("/data")
    class Data
    
    @KtorExperimentalLocationsAPI
    fun Route.data(client: HttpClient) {
        authenticate(SESSION_AUTH) {
            get<Data> {
            	val response = client.get<Info>("<http://localhost:8080>${application.locationToUrl(DataApi())}") {
                        header(HttpHeaders.Authorization, "Bearer ${call.getSession()?.accessToken}")
                        ...
                }
                ...
            }
            post<Data> {...}
        }
    }
    api/DataApi.kt
    @KtorExperimentalLocationsAPI
    @Location("$API_VERSION/data")
    class DataApi
    
    @KtorExperimentalLocationsAPI
    fun Route.dataApi(client: HttpClient) {
    //    authenticate(SESSION_AUTH) {
            get<DataApi> {
            	...
                val response = client.get<SomeApiData>("<https://www.googleapis.com/>...") {
                        parameter("key", params.apiKey)
                        header(HttpHeaders.Authorization, call.request.headers[HttpHeaders.Authorization])
                }
                ...
            }
            post<DataApi> {...}
    //    }
    }
    b
    • 2
    • 8
  • g

    Guilherme Delgado

    04/26/2021, 4:38 PM
    Everything is working but, I have the following questions: 1 - How can I setup refreshToken logic? I’ve searched in the docs/samples but I must have missed, can you point me to it? Btw, Google sends a null refreshToken, how will I manage auth-refresh in this case? 2 - Is authentication well configured? I thought I should incapsulate both Route.data and Route.dataApi with authenticate but if I wrap Route.dataApi for some reason I’ll receive a “400. That’s an error. Your client has issued a malformed or illegal request. ” from Google 😕 (both with SESSION_AUTH or GOOGLE_OAUTH). Why? 3 - How can I redirect to the page that asked for authentication in the client webApp? For instance, if I try to go to /data it asks for authentication (Route.login) and after success it fires call.redirect(Home()), how can I redirect to the Location that asked for auth? Thanks for you time! 🙏
    :thread-please: 4
    • 1
    • 1
  • d

    Dominaezzz

    04/27/2021, 5:57 PM
    interface Animal
    
    @Serializable
    class Dog : Animal
    
    @Serializable
    class Cat : Animal
    
    // subclasses are explicitly registered in serializerModule.
    
    client.get<...>("...") {
        contentType(Json)
        body = Dog()
    }
    How do I get ktor to do polymorphic serialisation correctly?
    body
    ends up being
    {}
    instead of
    { "type": "Dog" }
    .
    b
    a
    • 3
    • 8
  • d

    Dominick

    04/28/2021, 5:44 AM
    Whenever I run Ktor with Exposed, only the one that comes first actually works. For example, if I put the database stuff above the install if-statement, Hikari works fine and I get a bunch of console spam of hikari logs, however ktor doesn't connect. If I put Exposed at the bottom, ktor works but exposed doesn't. routing above transaction & datasource 2021-04-28 01:42:59.490 [main] INFO Application - Responding at http://0.0.0.0:2828 2021-04-28 01:42:59.490 [main] INFO Application - Responding at https://0.0.0.0:1818 routing below database stuff: 2021-04-28 01:34:18.495 [main] INFO Application - No ktor.deployment.watch patterns specified, automatic reload is not active 2021-04-28 01:34:18.942 [main] DEBUG com.zaxxer.hikari.HikariConfig - Driver class com.mysql.cj.jdbc.Driver found in Thread context class loader sun.misc.Launcher$AppClassLoader@1b6d3586 2021-04-28 01:34:19.026 [main] DEBUG com.zaxxer.hikari.HikariConfig - HikariPool-1 - configuration: ....
    @Suppress("unused") // Referenced in application.conf
    @kotlin.jvm.JvmOverloads
    fun Application.module(testing: Boolean = false) {
        // <https://ktor.io/servers/features/https-redirect.html#testing>
        if (!testing) {
            install(HttpsRedirect) {
                // The port to redirect to. By default 443, the default HTTPS port.
                sslPort = 1818
                // 301 Moved Permanently, or 302 Found redirect.
                permanentRedirect = true
            }
        }
        install(ContentNegotiation) {
            gson {}
        }
    
        routing {
            userRoutes()
            /*
            fileRoutes()
            miscRoutes()
            deliveryRoutes()
            */
    
            static("/") {
                files("public")
                default("public/index.html")
            }
        }
    
        val dataSource = HikariDataSource().apply {
            maximumPoolSize = 20
            driverClassName = "com.mysql.cj.jdbc.Driver"
            jdbcUrl = "[removed]"
            addDataSourceProperty("user", "mediauser")
            addDataSourceProperty("password", "[removed]")
            isAutoCommit = false
        }
    
        Database.Companion.connect(dataSource)
    
        transaction {
            addLogger(StdOutSqlLogger)
            SchemaUtils.create(MediaPropertiesTable, MediaContentTable, UserAPIKeysTable, UserTable)
        }
    
        Thread(ConsoleRunnable).run()
    }
    :thread-please: 2
    l
    • 2
    • 1
  • c

    christophsturm

    04/28/2021, 1:49 PM
    not really a problem in ktor, but the ktor source causes a lot of exceptions in idea. just git checkout main, open the project in idea, and the exception reporter starts reporting errors. Its also not possible to navigate by control clicking.
    e
    • 2
    • 5
  • h

    hhariri

    04/28/2021, 2:03 PM
    Many folks have told us that they lack guidance on real-world samples with Ktor. We’re going to work on fixing this. Do let us know (either here or replying to the tweet), what you’d like to see. https://twitter.com/JetBrainsKtor/status/1387406887315025924
    ❤️ 15
    :ktor: 2
    :kotlin-intensifies: 17
    m
    v
    +10
    • 13
    • 19
  • r

    rsktash

    04/29/2021, 9:46 AM
    Hi. Why I can’t request GET request with body?
    b
    c
    j
    • 4
    • 12
  • t

    Tim Malseed

    04/29/2021, 11:11 AM
    I’m encountering the following error.
    Exception in thread “main” io.ktor.application.DuplicateApplicationFeatureException: Conflicting application feature is already installed with the same key as
    Call Logging
    embeddedServer(
        factory = Netty,
        port = 8080,
        host = "0.0.0.0",
        watchPaths = listOf("classes"),
        module = {
            install(CallLogging)
            install(CachingHeaders)
            artworkRouting()
        }
    I can’t figure out why this has suddenly started occurring.. Any ideas?
    🆘 1
    • 1
    • 3
  • g

    Guilherme Delgado

    04/29/2021, 12:15 PM
    Hello, Is this the correct procedure to catch a 3rd party API error, parse it to evaluate the type of exception, and proceed with custom logic? Details in thread :thread-please: Thanks!
    • 1
    • 1
  • t

    turansky

    04/30/2021, 12:01 AM
    Is there plans to release Ktor, which will be compatible with Kotlin
    1.5.0
    ? Ktor update required for: 1. Coroutines
    1.5.0-RC
    2. Serialization
    1.2.0
    3. Kotlin Wrappers update Bulk update required, because JS module name of serialization library was changed 😞
    ❓ 1
    ➕ 3
    e
    • 2
    • 2
  • t

    Tim Malseed

    04/30/2021, 4:13 AM
    I figured out the cause of the
    DuplicateApplicationFeatureException
    , I believe it's due to a bug in Ktor (sort of tracked here: https://youtrack.jetbrains.com/issue/KTOR-2586)
    • 1
    • 1
  • t

    Tim Malseed

    04/30/2021, 12:29 PM
    I’m having trouble getting the remote jvm debugger to attach to my ktor application. The application runs in a docker container, via
    installDist
    as per the documentation. Running on openjdk 11 JVM args are :
    applicationDefaultJvmArgs = listOf(
        "-Dio.ktor.development=true",
        "-Dagentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:8081"
    )
    I’ve exposed the port 8081.
    c
    • 2
    • 13
  • m

    Michael

    04/30/2021, 5:06 PM
    message has been deleted
    t
    • 2
    • 17
  • a

    andylamax

    04/30/2021, 6:19 PM
    Hi fella, hope you are doing good. So, I have the following configuration in my server
    routing {
      get("/") {
        // this works as expected
      }
    
      static("/") {
        // I have this as well
      }
    
      //and
      get("/config/{file}") {
        // overridden by static("/")
      }
    }
    Question is, how do I implement both
    static("/")
    overriding my
    get("/config/{file}")
    . With both of them existing, ,aking a get request to
    /config/user1
    returns not fount. I am assuming it is looking to the files served as static resources. Help?
    r
    r
    • 3
    • 4
  • p

    Patrick Ramsey

    05/01/2021, 12:11 AM
    ktor-client question --- I’m trying to make an HTTP POST request with an xml body and no magic serialization, and to set the ContentType header. I assumed I could do, e.g.
    val xmlBody: String = [prepare body]
    
    <http://client.post|client.post>([uri]) {
        contentType(ContentType.Text.Xml)
        body = xmlBody
    }
    However, I’m getting,
    io.ktor.http.UnsafeHeaderException: Header(s) [Content-Type] are controlled by the engine and cannot be set explicitly
    What’s the correct way to specify the Content-Type header, if not by explicitly calling contentType()?
    • 1
    • 4
  • m

    Matvei Vdovitsyn

    05/01/2021, 7:11 PM
    Why may Ktor Authentication feature's authenticated route handlers be executed with empty principal, despite of not being optional? Code further in thread
    s
    • 2
    • 3
  • r

    Ryan Simon

    05/01/2021, 7:36 PM
    Hey all, is there a default database connection pooler for Ktor + Exposed or do you need to use something like Hikari? Haven't been able to find a definitive answer from the docs
    f
    • 2
    • 2
  • c

    CLOVIS

    05/03/2021, 10:54 AM
    I see that Ktor has a generator that reads OpenAPI, is there a way to do the opposite (generate an OpenAPI file from my route declarations)?
    j
    r
    +3
    • 6
    • 9
  • s

    spierce7

    05/03/2021, 4:19 PM
    For Ktor Server - If I wanted to log the request for any server error in ktor, what would be the best way to do that?
    c
    • 2
    • 4
  • m

    MBegemot

    05/03/2021, 5:11 PM
    In Android, since ktor 1.5.3 I been having at random times a failure in client requests, if I use android engine I've got unexpected end of stream time to time, If I use CIO engine I've got IllegalStateException expected 8 bytes in the trailer actual 7. time to time too. And well the request is just the same it works ok 7 times and fails 3 +-. I thing there should to be a bug somewhere .....
    • 1
    • 1
  • d

    Dominick

    05/04/2021, 2:52 PM
    Say a user tries hitting the endpoint with a 5 gb file, and I use this code:
    val buffer = (part as PartData.FileItem).streamProvider().buffered()
    Those 5gb will never load into memory correct? Is there a way I can get the size of the uploaded file without loading it all into memory as well?
    f
    • 2
    • 1
  • g

    Guilherme Delgado

    05/05/2021, 10:32 AM
    Hello all, I’m using SLQDelight to create a DB. Everything is ok and works as expected, my question is: How can I avoid BD recreation every-time I run/kill my localhost server? 🤔 All my tables are created with
    CREATE TABLE IF NOT EXISTS
    so I assume the file is being deleted. How can I avoid that? Also, where’s the file located? I don’t have this problem in KMM projects (for android/ios), the BD is never deleted (only if I clean cache of course). Thanks!
    • 1
    • 1
  • n

    Nikky

    05/05/2021, 8:04 PM
    i am trying to use
    Curl
    engine on desktop i am running into
    C:\Users\nikky\.konan\dependencies\msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1\bin\ld: cannot find -lcurl
    i am trying to figure out where i need to install curl.. or what magic env var i have to set i am guessing i need to install
    pacman -S mingw-w64-x86_64-curl
    in MSYS2, but apparently it is not picked up maybe because my msys2 is not in the default location? i also installed
    curl
    via scoop, not sure what else i can do
    d
    • 2
    • 11
  • n

    Norbert Sziráczki

    05/06/2021, 1:38 PM
    Hey folks! I'm using Ktor in a Kotlin Multiplatform project, where I have a strange error. I was wondering if you could help me out on what could be the problem: So far I've been using ktor 1.4.0 with kotlinx serialization 1.0.0-RC and it was working properly (parsing json responses from our backend). I've tried to upgrade today and checked out ktor 1.5.4 with kotlinx serialization 1.2.0 and whenever my app would send a message to the server it instantly fails and returns the following message in the log: 2021-05-06 15:38:33.244 12301-12404/com.myappsid I/System.out: >> Exception: length=164; index=164
    t
    • 2
    • 1
  • c

    csieflyman

    05/06/2021, 4:48 PM
    I upgrade kotlin from 1.4.32 to 1.5.0 and compile failed... Does anyone had the same problem? Executing pre-compile tasks... Running 'before' tasks Checking sources Searching for compilable files... Kotlin: connecting to daemon Kotlin: compiling [ktor-example.main] Kotlin: kotlinc-jvm 1.5.0-release-759 (JRE 11.0.9.1+1-LTS) Kotlin: [Internal Error] java.lang.IllegalArgumentException: ClassicTypeSystemContext couldn't handle: Captured(*), class org.jetbrains.kotlin.resolve.calls.inference.CapturedType at org.jetbrains.kotlin.types.checker.ClassicTypeSystemContext$DefaultImpls.typeConstructor(ClassicTypeSystemContext.kt:150) at org.jetbrains.kotlin.types.checker.ClassicTypeCheckerContext.typeConstructor(ClassicTypeCheckerContext.kt:26) at org.jetbrains.kotlin.types.AbstractTypeChecker.isTypeVariableAgainstStarProjectionForSelfType(AbstractTypeChecker.kt:351)
    t
    • 2
    • 2
Powered by Linen
Title
c

csieflyman

05/06/2021, 4:48 PM
I upgrade kotlin from 1.4.32 to 1.5.0 and compile failed... Does anyone had the same problem? Executing pre-compile tasks... Running 'before' tasks Checking sources Searching for compilable files... Kotlin: connecting to daemon Kotlin: compiling [ktor-example.main] Kotlin: kotlinc-jvm 1.5.0-release-759 (JRE 11.0.9.1+1-LTS) Kotlin: [Internal Error] java.lang.IllegalArgumentException: ClassicTypeSystemContext couldn't handle: Captured(*), class org.jetbrains.kotlin.resolve.calls.inference.CapturedType at org.jetbrains.kotlin.types.checker.ClassicTypeSystemContext$DefaultImpls.typeConstructor(ClassicTypeSystemContext.kt:150) at org.jetbrains.kotlin.types.checker.ClassicTypeCheckerContext.typeConstructor(ClassicTypeCheckerContext.kt:26) at org.jetbrains.kotlin.types.AbstractTypeChecker.isTypeVariableAgainstStarProjectionForSelfType(AbstractTypeChecker.kt:351)
t

turansky

05/06/2021, 4:54 PM
There is no Ktor, compatible with Kotlin
1.5.0
😞 https://kotlinlang.slack.com/archives/C0A974TJ9/p1619881885019300?thread_ts=1619740875.494900&amp;cid=C0A974TJ9
c

csieflyman

05/06/2021, 5:16 PM
Thanks @turansky I received kotlin plugin upgrade notification today and click it... I uninstall plugin and problem has been solved
View count: 2