2

I had some waitQueue size limit exceeded issues in the past with my http4s-blaze-client@0.21.0-M6. As per the recommendation I am trying to upgrade my http4s version from 0.21.0-M6 to 0.21.33. Now I am facing the below compilation error in the code:

Symbol 'type cats.package.MonadThrow' is missing from the classpath.
This symbol is required by 'value org.http4s.Media.F'.
Make sure that type MonadThrow is in your classpath and check for conflicting dependencies with -Ylog-classpath.
A full rebuild may help if 'Media.class' was compiled against an incompatible version of cats.package.

could not find implicit value for parameter F: cats.MonadThrow[[_]F[_]]
     parsedRequest <- authedReq.req.as[CreateScheduleRequest]

I referred to https://http4s.org/versions.html and it looks like I am using all the compatible versions. The only dependency I changed was of the http4s. Rest of the dependencies were unchanged and were working fine with http4s@0,21,0-M6. I am new to http4s and cats-effect. Could someone please suggest what can be done to fix the above issue?

Below is the summary of my dependencies:

val mqtt         = "org.eclipse.paho"      % "org.eclipse.paho.client.mqttv3" % "1.2.2"
val doobie       = "org.tpolecat"         %% "doobie-core"                    % "0.8.8"
val doobieJDBC   = "org.tpolecat"         %% "doobie-postgres"                % "0.8.8"
val doobieCP     = "org.tpolecat"         %% "doobie-hikari"                  % "0.8.8"
val flyway       = "org.flywaydb"          % "flyway-core"                    % "6.2.2"
//common
val http4sDsl    = "org.http4s"           %% "http4s-dsl"                     % "0.21.33" //previously "0.21.0-M6"
val http4sServer = "org.http4s"           %% "http4s-blaze-server"            % "0.21.33" //previously "0.21.0-M6"
val http4sClient = "org.http4s"           %% "http4s-blaze-client"            % "0.21.33" //previously "0.21.0-M6"
val http4sCirce  = "org.http4s"           %% "http4s-circe"                   % "0.21.33" //previously "0.21.0-M6"
val chimney      = "io.scalaland"         %% "chimney"                        % "0.4.1"
val catsEffect   = "org.typelevel"        %% "cats-effect"                    % "2.1.0"
val mouse        = "org.typelevel"        %% "mouse"                          % "0.24"
val circeParser  = "io.circe"             %% "circe-parser"                   % "0.13.0"
val circeGeneric = "io.circe"             %% "circe-generic"                  % "0.13.0"
val circeGenExt  = "io.circe"             %% "circe-generic-extras"           % "0.13.0"
val config       = "com.typesafe"          % "config"                         % "1.4.0"
val logback      = "ch.qos.logback"        % "logback-classic"                % "1.2.3"
    //test
val moquette     = "io.moquette"           % "moquette-broker"                % "0.11"
val doobieH2     = "org.tpolecat"         %% "doobie-h2"                      % "0.8.8"
val scalaTest    = "org.scalatest"        %% "scalatest"                      % "3.2.0-M2"


scalaVersion = "2.13.1"

Below is the http4s route class that is giving the compilation error:

import java.time.LocalDateTime
import cats.effect._
import cats.implicits._
import io.circe.generic.auto._
import org.http4s._
import org.http4s.dsl._

class ScheduleRoute[F[_]: Effect] extends Http4sDsl[F] with HttpMarshalling with HttpResponseHandler[F] {

  final def serve(service: ScheduleServiceAlgebra[F]): AuthedService[User, F] = AuthedService{

    case authedReq @ POST -> Root / "buildings" / InstallationUuidVar(installationUuid) / "entries" as user =>
      val io = for {
        parsedRequest <- authedReq.req.as[CreateScheduleRequest]
        validRequest  <- parsedRequest.validate
        result        <- service.createSchedule(installationUuid, validRequest, user)
        now           <- Sync[F].delay(LocalDateTime.now(java.time.ZoneId.of("UTC")))
      } yield result.withNextOccurrenceTime(now)

      io.result

  }

}

P.S. I ran sbt evicted command and see the following. Does it mean I need to update some of the dependencies?

[warn] Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[warn] 
[warn]     * org.log4s:log4s_2.13:1.10.0 is selected over 1.9.0
[warn]         +- org.http4s:http4s-core_2.13:0.21.33 ()             (depends on 1.10.0)
[warn]         +- org.http4s:blaze-core_2.13:0.14.18                 (depends on 1.9.0)
[warn] 
[warn]     * co.fs2:fs2-core_2.13:2.5.9 is selected over 2.2.2
[warn]         +- co.fs2:fs2-io_2.13:2.5.9                           (depends on 2.5.9)
[warn]         +- org.http4s:http4s-core_2.13:0.21.33 ()             (depends on 2.5.9)
[warn]         +- org.http4s:jawn-fs2_2.13:1.0.0                     (depends on 2.2.2)
[warn] 
[warn] Run 'evicted' to see detailed eviction warnings
[info] Here are other depedency conflicts that were resolved:
[info] 
[info]     * org.typelevel:jawn-parser_2.13:1.0.1 is selected over 1.0.0
[info]         +- io.circe:circe-jawn_2.13:0.13.0 ()                 (depends on 1.0.0)
[info]         +- org.http4s:http4s-jawn_2.13:0.21.33 ()             (depends on 1.0.0)
[info]         +- org.http4s:jawn-fs2_2.13:1.0.0                     (depends on 1.0.0)
[info] 
[info]     * org.slf4j:slf4j-api:1.7.31 is selected over 1.7.30
[info]         +- org.log4s:log4s_2.13:1.10.0                        (depends on 1.7.30)
[info]         +- org.http4s:http4s-core_2.13:0.21.33 ()             (depends on 1.7.30)
Madhu Reddy
  • 53
  • 1
  • 8

0 Answers0