Are there any examples of using Sangria with a Scala 3 program, or is that a non-starter? Using cross-compilation in SBT builds OK, but getting a NoSuchMethodError
exception in Executor.execute
when I send a query.
build.sbt
looks like this:
val AkkaVersion = "2.6.21"
val SangriaAkkaHttpVersion = "0.0.4"
crossScalaVersions := Seq("2.13.5", "3.3.0")
ThisBuild / scalaVersion := "3.3.0"
("com.typesafe.akka" %% "akka-actor-typed" % AkkaVersion).cross(CrossVersion.for3Use2_13),
("com.typesafe.akka" %% "akka-stream-typed" % AkkaVersion).cross(CrossVersion.for3Use2_13),
("org.sangria-graphql" %% "sangria-akka-http-circe" % SangriaAkkaHttpVersion).cross(CrossVersion.for3Use2_13),
Any clues as to how to get this to work?
Error message:
java.lang.NoSuchMethodError: 'scala.runtime.BoxedUnit sangria.execution.Executor$.execute$default$4()'
at XXX.graphql.GraphQlServer$$anon$1.applyOrElse(GraphQlServer.scala:55)
at XXX.graphql.GraphQlServer$$anon$1.applyOrElse(GraphQlServer.scala:49)
at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:35)
at sangria.http.akka.SangriaAkkaHttp.$anonfun$prepareGraphQLPost$2(SangriaAkkaHttp.scala:137)
8
Akka 2.6.21 is released for Scala 3 – mvnrepository.com/artifact/com.typesafe.akka/akka-actor-typed, Sangra as well – mvnrepository.com/artifact/org.sangria-graphql/sangria . Only this "akka-http-circe" bridge is not available for Scala 3… but it's literary a single file – I would just remove
CrossVersion.for3Use2_13
and copy-pasted the source of this single file adding a comment to use library once it's published.17 hours ago
Could you share the complete error message and the related code?
17 hours ago
@MateuszKubuszok Thanks for the suggestion. Unfortunately
sangria-akka-http-circe
depends onsangria-akka-http-core
which is also still at Scala 2 and is a more comprehensive piece of code.4 hours ago
I looked at it and I would still give it a chance. I had a similar problem a few years ago: I temporarily needed to use a library which had bugs, which were fixed in much later version than I had and bumping library would be a several day long process and hardly justifiable effort. (I the fix was needed for migrating all data from this service to a new one). I downloaded the whole source code locally, edited and published locally, and when I saw that this worked I "inlined" this library as a module in my project, to be able to easily build the image in CI. It was also about Akka and its plugin
3 hours ago
@MateuszKubuszok OK, thanks, I'll give it a try!
3 hours ago