Reputation: 91
Has been working on this for a couple of days and still have no clue what's going on: Got a finch web service, the build.sbt dependencies look like:
"com.github.finagle" %% "finch-circe" % finchVersion changing(),
"com.github.finagle" %% "finch-core" % finchVersion changing(),
"com.github.finagle" %% "finch-jackson" % finchVersion changing(),
"com.github.finagle" %% "finch-test" % finchVersion changing(),
"com.twitter" %% "twitter-server" % "1.28.0",
The finch version is 0.14.0. And the endpoint looks like:
def makeService(statsReceiver: StatsReceiver): Service[Request, Response] = {
//val getUserCounter = statsReceiver.counter("get_user_counter")
(
MyEndpoint.endpoint1()
:+: SomeEndpoint.deleteEntity()
:+: SomeEndpoint.createEntity()
:+: SomeEndpoint.updateEntity()
) handle {
case e: InvalidClientError => Unauthorized(e)
case e: InvalidContextError => BadRequest(e)
case e: RelevanceError => BadRequest(e)
case e: Exception => InternalServerError(e)
} toService
And I got the error message on the line of "toService" like:
[error] /workplace/relevance-service/src/main/scala/com/company/service/endpoint/serviceEndpoints.scala:39: An Endpoint you're trying to convert into a Finagle service is missing one or more encoders.
[error]
[error] Make sure Exception 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]
And I looked at: https://github.com/finagle/finch/blob/master/docs/src/main/tut/cookbook.md#fixing-the-toservice-compile-error
and tried the lines of:
import io.finch.circe._
And first of all, this io.finch.circe._ is not used in the code since it is grey in the IDE. And I still got the same build error. I'm totally lost here. Anyone can help me out what am I missing here? google/bing around did not get me anything very useful.
Thanks.
Upvotes: 5
Views: 3346