zio-http icon indicating copy to clipboard operation
zio-http copied to clipboard

Server doesn't print unexpected error logs

Open livelxw opened this issue 1 year ago • 4 comments

Describe the bug The server doesn't print error logs when exceptions were thrown.

To Reproduce Scala 3:

import zio.http.*
import zio.{Scope, ZIO, ZIOAppArgs, ZIOAppDefault, ZLayer}

object Test extends ZIOAppDefault {
  val app = Http.collectZIO[Request] { case Method.GET -> Root / "test" => throw RuntimeException("test error") }

  override def run: ZIO[Any with ZIOAppArgs with Scope, Any, Any] = {
    Server
      .serve(app)
      .provide(
        ZLayer.succeed(Server.Config.default.enableRequestStreaming.port(8080)),
        Server.live
      )
  }
}

When send a request to http://localhost:8080/test, it responds empty body with 500 status code, and no error logs in server.

Expected behaviour It should print error logs in server.

livelxw avatar Oct 19 '23 01:10 livelxw

/bounty $75

To fix and add a reproducer testcase.

jdegoes avatar Jan 06 '24 21:01 jdegoes

💎 $75 bounty • ZIO

Steps to solve:

  1. Start working: Comment /attempt #2491 with your implementation plan
  2. Submit work: Create a pull request including /claim #2491 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to zio/zio-http!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🟢 @cheikhsimsol Jan 6, 2024, 10:26:44 PM WIP

algora-pbc[bot] avatar Jan 06 '24 21:01 algora-pbc[bot]

/attempt #2491

Options

cheikhsimsol avatar Jan 06 '24 22:01 cheikhsimsol