I'm interested in doing a Cloudflare Worker with K...
# webassembly
s
I'm interested in doing a Cloudflare Worker with Kotlin - preferably Kotlin/WASM. Does someone know / have a working sample for the current Kotlin version (2.2.10)? https://github.com/cloudflare/kotlin-worker-hello-world is clearly outdated and they don't seem to care - see the open issues and PRs. I tried the fork https://github.com/bashor/kotlin-worker-hello-world/ , but that fails for me - so maybe outdated, too. https://developers.cloudflare.com/workers/languages/ still mentions Kotlin, but I'm not sure if that's up to date.
c
You’re probably better off with Kotlin/JS for performance and bundle size.
1
I created this PR last year which should basically work when bumped to a newer Kotlin version: https://github.com/cloudflare/kotlin-worker-hello-world/pull/5
s
Yes, I saw that, but didn’t try yet. Do you know if it still works with the new version?
c
I have a private repo that works I don’t bother updating the PR because Cloudflare can’t bother to merge it
👍 1
s
I opened a issue to clarify the projects state. It looks like it’s unmaintained - nobody is responding to issues, no one reviews and pulls PRs. Doesn’t look to good.
Ok, I’ll check out your fork.
That’s the state of Kotlin at Cloudflare: The guy making the demo is gone and the rest of the team doesn’t see Kotlin support as a priority. Unfortunate. 😐 https://github.com/cloudflare/kotlin-worker-hello-world/issues/9
😔 1
Ok, your demo project works for me - thanks! I’m still getting my head around Kotlin/JS, so I asked ChatGPT to translate the code for me. It ended up full of
dynamic
types and deeply nested Promise calls 😅. I guess I’ll wait for Cloudflare to eventually offer proper Kotlin support. In the meantime, I’ll keep exploring Kotlin/Native AWS Lambdas, even though their free tier is only about a third of what Cloudflare offers.
c
Great, glad that worked for you. That’s pretty common for Kotlin/JS, unless you write your own external classes. This may get better with the future automatic generation of wrappers from TypesScript: https://blog.jetbrains.com/kotlin/2025/05/present-and-future-kotlin-for-web/#the-road-ahead-for-kotlin-for-web
👍 1