softwaremill / sttp

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

Found interface scalaz.zio.ZIO, but class was expected #201

Closed 7robertodantas closed 5 years ago

7robertodantas commented 5 years ago

I'm having some issues when creating sttp request using AsyncHttpClientZioBackend and newer releases of ZIO (1.0-RC3 and 1.0-RC4). It doesn't happen in 1.0-RC1.

The issue can be reproduced by the following ammonite sample:

import $ivy.`org.scalaz:scalaz-zio_2.12:1.0-RC4`
import $ivy.`com.softwaremill.sttp::core:1.5.12`
import $ivy.`com.softwaremill.sttp::async-http-client-backend-zio:1.5.12`

import scalaz.zio._
import com.softwaremill.sttp._
import com.softwaremill.sttp.asynchttpclient.zio.AsyncHttpClientZioBackend

implicit val backend: SttpBackend[Task, Nothing] = AsyncHttpClientZioBackend()
val request = sttp.get(uri"http://dummy.restapiexample.com/api/v1/employees").send()
java.lang.IncompatibleClassChangeError: Found interface scalaz.zio.ZIO, but class was expected
  com.softwaremill.sttp.impl.zio.IOMonadAsyncError$.flatMap(IOMonadAsyncError.scala:12)
  com.softwaremill.sttp.impl.zio.IOMonadAsyncError$.flatMap(IOMonadAsyncError.scala:6)
  com.softwaremill.sttp.MonadError.flatten(MonadError.scala:22)
  com.softwaremill.sttp.MonadError.flatten$(MonadError.scala:22)
  com.softwaremill.sttp.impl.zio.IOMonadAsyncError$.flatten(IOMonadAsyncError.scala:6)
  com.softwaremill.sttp.asynchttpclient.AsyncHttpClientBackend.send(AsyncHttpClientBackend.scala:45)
  com.softwaremill.sttp.FollowRedirectsBackend.sendWithCounter(FollowRedirectsBackend.scala:17)
  com.softwaremill.sttp.FollowRedirectsBackend.send(FollowRedirectsBackend.scala:12)
  com.softwaremill.sttp.RequestT.send(RequestT.scala:244)
  ammonite.$sess.cmd7$.<init>(cmd7.sc:1)
  ammonite.$sess.cmd7$.<clinit>(cmd7.sc)
7robertodantas commented 5 years ago

@adamw I've seen that you upgraded the ZIO dependency version in commit https://github.com/softwaremill/sttp/commit/19d833744d05c4efb88802eb2cf08cf4fc0487f7 if that fixes this issue could you release a new sttp version so I could use it in my project?

adamw commented 5 years ago

Yes, sorry! 1.5.15 released.