question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Simple code straight from documentation returns ERR_EMPTY_RESPONSE

See original GitHub issue

Using 0.9.3 (current version) I tried the following simple code from the documentation:

fun main(args: Array<String>) {
 val s = embeddedServer(Netty, port = 8080) {
        routing {
            get("/") {
                call.respondText("Hello World!", ContentType.Text.Plain)
            }
            get("/demo") {
                call.respondText("HELLO WORLD!")
            }
        }
    }
    s.start(wait = true)
}

When I run this code I see:

238 [main] INFO ktor.application - No ktor.deployment.watch patterns specified, automatic reload is not active
290 [main] INFO ktor.application - Responding at http://0.0.0.0:8080

When I visit http://localhost:8080/ in my browser I get ERR_EMPTY_RESPONSE. Adding a println() at the beginning of the get("/") block reveals that it doesn’t seem to be executing any of that code at all.

I’m currently using ktor in a separate project which doesn’t suffer from this problem - I’ve got no idea what’s different between one and the other. Would appreciate any ideas.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:19 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
FlatMapIOcommented, Jan 21, 2021

http://0.0.0.0:8080 can’t be accessed, 127.0.0.1:8080 can

1reaction
sanitycommented, Aug 17, 2018

Just FYI - my workaround was to use Jetty instead of Netty.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Simple code straight from documentation returns ... - GitHub
When I visit http://localhost:8080/ in my browser I get ERR_EMPTY_RESPONSE. Adding a println() at the beginning of the get("/") block reveals that it ......
Read more >
How to Fix the ERR_EMPTY_RESPONSE Chrome Error (Full ...
ERR_EMPTY_RESPONSE is a web browser error that can appear in Chrome and Chromium-based web browsers, such as Microsoft Edge or Opera. It means ......
Read more >
How To Fix the "ERR_EMPTY_RESPONSE" Error (5 Potential ...
This error is often caused by connectivity issues, such as a poor internet connection or problems with the server itself. It can also...
Read more >
Getting ERR_EMPTY_RESPONSE on $.POST - Stack Overflow
The code works well on all pages except message.php where the user message is posted and fetched multiple times with $.post (used to...
Read more >
ERR_EMPTY_RESPONSE | 8 Ways to Fix It
The "ERR_EMPTY_RESPONSE" error may be caused by files stored in the "Temp" folder in Windows. To remove these files, press the Windows key...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found