joroKr21 on master
Update sbt-sonatype to 3.9.13 Merge pull request #1490 from s… (compare)
joroKr21 on dispatcher-testing-apis
Update finagle-http, finagle-st… Merge pull request #1479 from s… Stop magically converting Twitt… and 17 more (compare)
joroKr21 on master
Update cats-effect to 3.3.12 Merge pull request #1489 from s… (compare)
joroKr21 on master
Update circe-core, circe-generi… Merge pull request #1488 from s… (compare)
joroKr21 on master
Update sbt-wartremover, wartrem… Merge pull request #1487 from s… (compare)
vkostyukov on validated-again
vkostyukov on master
Get rid of RequestItem; rework … (compare)
[error] /path/to/File.scala:30:41: Symbol 'type shapeless.ops.FnToProductInstances.Aux' is missing from the classpath.
[error] This symbol is required by 'value io.finch.internal.Mapper.ftp'.
[error] Make sure that type Aux is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
[error] A full rebuild may help if 'Mapper.class' was compiled against an incompatible version of shapeless.ops.FnToProductInstances
is finched not being maintained anymore?
I wouldn't say unmaintained, but definitely less active recently
there you go, here's a minimal test case.
build file:
libraryDependencies ++= Seq(
"com.github.finagle" %% "finchx-circe" % "0.32.1",
"com.chuusai" %% "shapeless" % "2.3.6"
)
Main file:
import io.finch._
import cats.effect.IO
object Main extends App with Endpoint.Module[IO] {
val hello: Endpoint[IO, String] = get("hello") { Ok("Hello, World!") }
}
[error] /path/to/project/src/main/scala/Main.scala:5:55: Symbol 'type shapeless.ops.FnToProductInstances.Aux' is missing from the classpath.
[error] This symbol is required by 'value io.finch.internal.Mapper.ftp'.
[error] Make sure that type Aux is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
[error] A full rebuild may help if 'Mapper.class' was compiled against an incompatible version of shapeless.ops.FnToProductInstances.
[error] val hello: Endpoint[IO, String] = get("hello") { Ok("Hello, World!") }
[error] ^
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 0 s, completed 26-May-2021 16:38:12
Hi, I'm new to things like Finch and Cats Effect and trying a few experiments. I tried to adapt the https://github.com/finagle/finch#hello-world example using scala 3 and I am getting an encoder error.
My build.stb looks like
val scala3Version = "3.0.2"
lazy val root = project
.in(file("."))
.settings(
name := "scala3-simple",
version := "0.1.0",
scalaVersion := scala3Version,
libraryDependencies ++= Seq(
"com.github.finagle" % "finchx-core_2.13" % "0.32.1",
"com.github.finagle" % "finchx-circe_2.13" % "0.32.1",
"io.circe" % "circe-generic_2.13" % "0.14.1"
)
)
My Main.scala looks like
import cats.effect.IO
import io.finch._
import com.twitter.finagle.Http
import com.twitter.util.Await
object Main extends App with Endpoint.Module[IO] {
val api: Endpoint[IO, String] = get("hello") {
Ok("hello")
}
Await.ready(Http.server.serve(":8080", api.toServiceAs[Text.Plain]))
}
When I try to sbt run
, I get the following error message:
[error] -- Error: C:\Users\Kris.garcia\Code\open\birdir\src\main\scala\Main.scala:11:68
[error] 11 | Await.ready(Http.server.serve(":8080", api.toServiceAs[Text.Plain]))
[error] | ^
[error] |An Endpoint you're trying to convert into a Finagle service is missing one or more encoders.
[error] |
[error] | Make sure A is one of the following:
[error] |
[error] | * A com.twitter.finagle.http.Response
[error] | * A value of a type with an io.finch.Encode instance (with the corresponding content-type)
[error] | * A coproduct made up of some combination of the above
[error] |
[error] | See https://github.com/finagle/finch/blob/master/docs/src/main/tut/cookbook.md#fixing-the-toservice-compile-error
[error] |.
[error] |I found:
[error] |
[error] | io.finch.ToResponse.valueToResponse[cats.effect.IO, String,
[error] | ("text/plain" : String)
[error] | ](cats.effect.IO.ioEffect, io.finch.Encode.encodeStringAsTextPlain,
[error] | shapeless.Witness.apply[T]
[error] | )
[error] |
[error] |But method apply in object Witness does not match type shapeless.Witness.Aux[("text/plain" : String)].
[error] |
[error] |One of the following imports might make progress towards fixing the problem:
[error] |
[error] | import shapeless.~?>.idKeyWitness
[error] | import shapeless.~?>.idValueWitness
[error] | import shapeless.~?>.witness
[error] |
[error] one error found
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 9 s, completed Sep 11, 2021, 4:39:25 PM
Now, I did try adding the different shapeless imports as suggested, but unfortunately the error itself was not resolved.
Could anybody offer some insight or suggestions?
This release is expected to be the last one for finchx prefixed artifacts. Starting from the next update we're going to decommission the Future-based finch artifacts and replace it with polymorphic one.
I'm in the process of trying to upgrade some finch-based services to Scala 2.13.8, and am encountering some weird weird issues.
In order to debug, I tried to take one of the finch examples (the div endpoint) and compile it with 2.13.8, which fails. I then downgrading to 2.13.6, which was the version I was using previously, and that failed too.
Kind of at a loss here. Here's my buildfile:
libraryDependencies ++= Seq(
"com.github.finagle" %% "finchx-circe" % "0.32.1"
)
libraryDependencies ++= Seq(
"io.circe" %% "circe-generic" % "0.13.0",
"com.twitter" %% "finagle-stats" % "20.9.0",
"com.twitter" %% "twitter-server" % "20.9.0"
)
scalaVersion := "2.13.6"
I simply copy and pasted the code:
import cats.effect.IO
import com.twitter.finagle.Http
import com.twitter.util.Await
import io.finch._
/**
* A tiny Finch application that serves a single endpoint `POST /:a/b:` that divides `a` by `b`.
*
* Use the following sbt command to run the application.
*
* {{{
* $ sbt 'examples/runMain io.finch.div.Main'
* }}}
*
* Use the following HTTPie commands to test endpoints.
*
* {{{
* $ http POST :8081/20/10
* $ http POST :8081/10/0
* }}}
*/
object Main extends App with Endpoint.Module[IO] {
// We can serve Ints as plain/text responses since there is cats.Show[Int]
// available via the cats.instances.int._ import.
def div: Endpoint[IO, Int] = post(path[Int] :: path[Int]) { (a: Int, b: Int) =>
Ok(a / b)
} handle { case e: ArithmeticException =>
BadRequest(e)
}
Await.ready(Http.server.serve(":8081", div.toServiceAs[Text.Plain]))
}
And am getting the following error:
[error] /path/to/tests/finch/src/main/scala/Main.scala:32:57: An Endpoint you're trying to convert into a Finagle service is missing one or more encoders.
[error]
[error] Make sure Int is one of the following:
[error]
[error] * A com.twitter.finagle.http.Response
[error] * A value of a type with an io.finch.Encode instance (with the corresponding content-type)
[error] * A coproduct made up of some combination of the above
[error]
[error] See https://github.com/finagle/finch/blob/master/docs/src/main/tut/cookbook.md#fixing-the-toservice-compile-error
[error] Await.ready(Http.server.serve(":8081", div.toServiceAs[Text.Plain]))
[error] ^
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 3 s, completed 16-Feb-2022 15:12:32