softwaremill / sttp

The Scala HTTP client you always wanted!
https://sttp.softwaremill.com
Apache License 2.0
1.46k stars 309 forks source link

Ensure compatibility with ZIO 2.0 (Final) #1486

Closed aalbul closed 2 years ago

aalbul commented 2 years ago

Hi,

It seems like current STTP version (3.6.2) is not compatible with ZIO 2.0 Final release. It works well with ZIO RC6 though. Most probably, it's due to an old version of zio.interop.reactivestreams that STTP depends on. When i'm trying to use streaming capabilities, i'm getting the following:

java.lang.NoSuchMethodError: 'void zio.Promise.unsafeDone(zio.ZIO)'
    at zio.interop.reactivestreams.Adapters$$anon$1.onSubscribe(Adapters.scala:176)
    at sttp.client3.asynchttpclient.AsyncHttpClientBackend$$anon$1$$anon$2$$anon$3.onSubscribe(AsyncHttpClientBackend.scala:112)
    at org.asynchttpclient.netty.handler.StreamedResponsePublisher$ErrorReplacingSubscriber.onSubscribe(StreamedResponsePublisher.java:98)
    at com.typesafe.netty.HandlerPublisher.provideSubscriber(HandlerPublisher.java:193)
    at com.typesafe.netty.HandlerPublisher.access$000(HandlerPublisher.java:41)
    at com.typesafe.netty.HandlerPublisher$2.run(HandlerPublisher.java:172)
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.base/java.lang.Thread.run(Thread.java:833)

For sure, when i explicitly depend on

"dev.zio" %% "zio-interop-reactivestreams" % "2.0.0"

It goes back to normal

Pask423 commented 2 years ago

Already in progress https://github.com/softwaremill/sttp/pull/1469

adamw commented 2 years ago

See https://discord.com/channels/629491597070827530/630498701860929559/997473516339335259 for some more discussion

adamw commented 2 years ago

Already done :)