zio / zio-http

A next-generation Scala framework for building scalable, correct, and efficient HTTP clients and servers
https://zio.dev/zio-http
Apache License 2.0
796 stars 400 forks source link

Cannot compile code after upgrading up to zio-http 3.0.0 #3142

Closed dobrynya closed 1 month ago

dobrynya commented 1 month ago

Describe the bug Cannot compile ScalaJS code after upgrading to zio-http 3.0.0.

I use declarative Endpoint definitions with Int URL encoded parameters like the following

Endpoint(PUT / "api" / "groups" / int("groupId"))

I get this message when compiling my code

[info] Fast optimizing scala-3.5.0\front-fastopt [error] Referring to non-existent method static java.util.Objects.checkFromToIndex(int,int,int)int [error] called from zio.http.codec.PathCodecPlatformSpecific.parseLong(java.lang.CharSequence,int,int,int)long [error] dispatched from zio.http.codec.PathCodec.parseLong(java.lang.CharSequence,int,int,int)long [error] called from private zio.http.codec.PathCodec.decodeSubstring(java.lang.String,[zio.http.codec.PathCodec$Opt,java.util.Deque)java.lang.String [error] called from zio.http.codec.PathCodec.decode(zio.http.Path)scala.util.Either [error] called from private zio.http.codec.internal.EncoderDecoder$Single.decodePaths$$anonfun$1(zio.http.codec.PathCodec,zio.http.Path)java.lang.Object [error] called from private zio.http.codec.internal.EncoderDecoder$Single.decodePaths(zio.http.Path,[java.lang.Object)void [error] called from private zio.http.codec.internal.EncoderDecoder$Single.decode$$anonfun$2(zio.http.URL,zio.http.codec.CodecConfig,zio.http.Status,zio.http.Method,zio.http.Headers,zio.http.Body,java.lang.Object)zio.ZIO [error] called from zio.http.codec.internal.EncoderDecoder$Single.decode(zio.http.codec.CodecConfig,zio.http.URL,zio.http.Status,zio.http.Method,zio.http.Headers,zio.http.Body,java.lang.Object)zio.ZIO [error] called from private zio.http.codec.internal.EncoderDecoder$Multiple.tryDecode$1(java.lang.Object,zio.http.codec.CodecConfig,zio.http.URL,zio.http.Status,zio.http.Method,zio.http.Headers,zio.http.Body,int,zio.Cause)zio.ZIO [error] called from zio.http.codec.internal.EncoderDecoder$Multiple.decode(zio.http.codec.CodecConfig,zio.http.URL,zio.http.Status,zio.http.Method,zio.http.Headers,zio.http.Body,java.lang.Object)zio.ZIO [error] dispatched from zio.http.codec.internal.EncoderDecoder.decode(zio.http.codec.CodecConfig,zio.http.URL,zio.http.Status,zio.http.Method,zio.http.Headers,zio.http.Body,java.lang.Object)zio.ZIO [error] called from zio.http.codec.HttpCodec.decodeResponse(zio.http.Response,zio.http.codec.CodecConfig,java.lang.Object)zio.ZIO [error] called from private zio.http.endpoint.internal.EndpointClient.execute$$anonfun$1(java.lang.Object,zio.http.Response)zio.ZIO [error] called from zio.http.endpoint.internal.EndpointClient.execute(zio.http.ZClient,zio.http.endpoint.Invocation,zio.ZIO,zio.http.codec.Combiner,java.lang.Object)zio.ZIO [error] called from private zio.http.endpoint.EndpointExecutor.apply$$anonfun$2(zio.http.endpoint.Invocation,java.lang.Object,zio.http.endpoint.internal.EndpointClient)zio.ZIO [error] called from zio.http.endpoint.EndpointExecutor.apply(zio.http.endpoint.Invocation,java.lang.Object)zio.ZIO [error] called from private myorg.PublicServer.loadKeycloakConfig$$anonfun$1()zio.ZIO [error] called from myorg.PublicServer.loadKeycloakConfig()zio.ZIO [error] called from myorg.security.SecurityService$.make(myorg.PublicServer)zio.ZIO [error] called from myorg.UnauthenticatedPage.init()scala.Tuple2 [error] dispatched from myorg.Component.init()scala.Tuple2 [error] called from myorg.MainPage.init()scala.Tuple2 [error] called from myorg.App$.init(scala.collection.immutable.Map)scala.Tuple2 [error] dispatched from tyrian.TyrianApp.init(scala.collection.immutable.Map)scala.Tuple2 [error] called from private tyrian.TyrianApp._init(scala.collection.immutable.Map)scala.Tuple2 [error] called from tyrian.TyrianApp.ready(org.scalajs.dom.Element,scala.collection.immutable.Map)void [error] called from tyrian.TyrianApp.launch(org.scalajs.dom.Element,scala.scalajs.js.Dictionary)void [error] called from tyrian.TyrianApp.$js$exported$meth$launch(org.scalajs.dom.Element,scala.scalajs.js.Dictionary)java.lang.Object [error] called from myorg.App$.$js$exported$meth$launch(org.scalajs.dom.Element,scala.scalajs.js.Dictionary)java.lang.Object [error] exported to JavaScript with @JSExport [error] involving instantiated classes: [error] zio.http.codec.internal.EncoderDecoder$Single [error] zio.http.codec.internal.EncoderDecoder$Multiple [error] zio.http.endpoint.internal.EndpointClient [error] zio.http.endpoint.EndpointExecutor [error] myorg.PublicServer [error] myorg.security.SecurityService$ [error] myorg.UnauthenticatedPage [error] myorg.MainPage [error] myorg.App$ [error] Referring to non-existent method static java.util.Objects.checkFromToIndex(int,int,int)int [error] called from zio.http.codec.PathCodecPlatformSpecific.parseInt(java.lang.CharSequence,int,int,int)int [error] dispatched from zio.http.codec.PathCodec.parseInt(java.lang.CharSequence,int,int,int)int [error] called from private zio.http.codec.PathCodec.decodeSubstring(java.lang.String,[zio.http.codec.PathCodec$Opt,java.util.Deque)java.lang.String [error] called from zio.http.codec.PathCodec.decode(zio.http.Path)scala.util.Either [error] called from private zio.http.codec.internal.EncoderDecoder$Single.decodePaths$$anonfun$1(zio.http.codec.PathCodec,zio.http.Path)java.lang.Object [error] called from private zio.http.codec.internal.EncoderDecoder$Single.decodePaths(zio.http.Path,[java.lang.Object)void [error] called from private zio.http.codec.internal.EncoderDecoder$Single.decode$$anonfun$2(zio.http.URL,zio.http.codec.CodecConfig,zio.http.Status,zio.http.Method,zio.http.Headers,zio.http.Body,java.lang.Object)zio.ZIO [error] called from zio.http.codec.internal.EncoderDecoder$Single.decode(zio.http.codec.CodecConfig,zio.http.URL,zio.http.Status,zio.http.Method,zio.http.Headers,zio.http.Body,java.lang.Object)zio.ZIO [error] called from private zio.http.codec.internal.EncoderDecoder$Multiple.tryDecode$1(java.lang.Object,zio.http.codec.CodecConfig,zio.http.URL,zio.http.Status,zio.http.Method,zio.http.Headers,zio.http.Body,int,zio.Cause)zio.ZIO [error] called from zio.http.codec.internal.EncoderDecoder$Multiple.decode(zio.http.codec.CodecConfig,zio.http.URL,zio.http.Status,zio.http.Method,zio.http.Headers,zio.http.Body,java.lang.Object)zio.ZIO [error] dispatched from zio.http.codec.internal.EncoderDecoder.decode(zio.http.codec.CodecConfig,zio.http.URL,zio.http.Status,zio.http.Method,zio.http.Headers,zio.http.Body,java.lang.Object)zio.ZIO [error] called from zio.http.codec.HttpCodec.decodeResponse(zio.http.Response,zio.http.codec.CodecConfig,java.lang.Object)zio.ZIO [error] called from private zio.http.endpoint.internal.EndpointClient.execute$$anonfun$1(java.lang.Object,zio.http.Response)zio.ZIO [error] called from zio.http.endpoint.internal.EndpointClient.execute(zio.http.ZClient,zio.http.endpoint.Invocation,zio.ZIO,zio.http.codec.Combiner,java.lang.Object)zio.ZIO [error] called from private zio.http.endpoint.EndpointExecutor.apply$$anonfun$2(zio.http.endpoint.Invocation,java.lang.Object,zio.http.endpoint.internal.EndpointClient)zio.ZIO [error] called from zio.http.endpoint.EndpointExecutor.apply(zio.http.endpoint.Invocation,java.lang.Object)zio.ZIO [error] called from private myorg.PublicServer.loadKeycloakConfig$$anonfun$1()zio.ZIO [error] called from myorg.PublicServer.loadKeycloakConfig()zio.ZIO [error] called from myorg.security.SecurityService$.make(myorg.PublicServer)zio.ZIO [error] called from myorg.UnauthenticatedPage.init()scala.Tuple2 [error] dispatched from myorg.Component.init()scala.Tuple2 [error] called from myorg.MainPage.init()scala.Tuple2 [error] called from myorg.App$.init(scala.collection.immutable.Map)scala.Tuple2 [error] dispatched from tyrian.TyrianApp.init(scala.collection.immutable.Map)scala.Tuple2 [error] called from private tyrian.TyrianApp._init(scala.collection.immutable.Map)scala.Tuple2 [error] called from tyrian.TyrianApp.ready(org.scalajs.dom.Element,scala.collection.immutable.Map)void [error] called from tyrian.TyrianApp.launch(org.scalajs.dom.Element,scala.scalajs.js.Dictionary)void [error] called from tyrian.TyrianApp.$js$exported$meth$launch(org.scalajs.dom.Element,scala.scalajs.js.Dictionary)java.lang.Object [error] called from myorg.App$.$js$exported$meth$launch(org.scalajs.dom.Element,scala.scalajs.js.Dictionary)java.lang.Object [error] exported to JavaScript with @JSExport [error] involving instantiated classes: [error] zio.http.codec.internal.EncoderDecoder$Single [error] zio.http.codec.internal.EncoderDecoder$Multiple [error] zio.http.endpoint.internal.EndpointClient [error] zio.http.endpoint.EndpointExecutor [error] myorg.PublicServer [error] myorg.security.SecurityService$ [error] myorg.UnauthenticatedPage [error] myorg.MainPage [error] myorg.App$ [error] There were linking errors [error] (Compile / fastLinkJS) There were linking errors

Expected behaviour A code should be successfully compiled with zio-http 3.0.0 like with zio-http-3.0.0-RC9

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

jdegoes commented 1 month ago

/bounty $125 for fix and Scala JS test case.

algora-pbc[bot] commented 1 month ago

šŸ’Ž $125 bounty ā€¢ ZIO

Steps to solve:

  1. Start working: Comment /attempt #3142 with your implementation plan
  2. Submit work: Create a pull request including /claim #3142 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 bounty ā€¢ Share on socials

Attempt Started (GMT+0) Solution
šŸŸ¢ @asr2003 Sep 18, 2024, 1:47:17 PM #3155
asr2003 commented 1 month ago

/attempt #3142

Algora profile Completed bounties Tech Active attempts Options
@asr2003    2 ZIO bounties
+ 2 bounties from 2 projects
JavaScript, Go,
HTML & more
Cancel attempt
algora-pbc[bot] commented 1 month ago

šŸ’” @asr2003 submitted a pull request that claims the bounty. You can visit your bounty board to reward.

algora-pbc[bot] commented 1 month ago

šŸŽ‰šŸŽˆ @asr2003 has been awarded $125! šŸŽˆšŸŽŠ