akka-http error: could not find implicit value for parameter um: akka.http.scaladsl.unmarshalling.FromRequestUnmarshaller

I know that has been asked already, but I can't seem to find an answer. Here is my code :

import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport
import spray.json.DefaultJsonProtocol

final case class Client(clientId:Int, clientName:String, platformIds:Int, host:String, password:String)

object ClientJson extends DefaultJsonProtocol with SprayJsonSupport {
    implicit val clientFormat = jsonFormat5(Client)
}

class HTTPListenerActor extends Actor with ImplicitMaterializer with RoadMap {

implicit val conf = context.system.settings.config
implicit val system = context.system
implicit val ec = context.dispatcher


Await.result(Http().bindAndHandle(roads, "interface", 8080), Duration.Inf)

override def receive:Receive = Actor.emptyBehavior
}

trait RoadMap extends Directives  {

val roads: Route = path("client"/IntNumber) { id =>
    import ClientJson._
    post {
        entity(as[Client]) { c => complete {c} }
    }
  }
}

This code generates error

 [ant:scalac] /Users/smalov/Workspace/api-service/src/main/scala/com/acheron/HTTPListenerActor.scala:51: error: could not find implicit value for parameter um: akka.http.scaladsl.unmarshalling.FromRequestUnmarshaller[com.acheron.Client]
 [ant:scalac]           entity(as[Client]) { c =>

Now the most common cause for this kind of error is forgetting to import marshalling implicit into the scope near the roads definition, however, I did not forget this. Another reason could be that I have implicit FlowMaterializer in scope instead of ActorMaterializer, but ImplictMaterializer trait takes care of this.

Anything else I could be missing ?

I'm using Scala 2.11.7, Akka 2.3.11, akka-http 1.0, spray-json 1.3.2

I too got the same error and it resolved after importing

" akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._ "

May be this will help

akka/akka, I'm trying to use the entity router to unmarshall a request with json content, A compile error said: Error:(26, 18) could not find implicit value for parameter um: akka.http.scaladsl.unmarshalling.FromRequestUnmarshaller[Template] entity Error:(32, 20) could not find implicit value for parameter um: akka.http.scaladsl.unmarshalling.FromRequestUnmarshaller[com.example.crudapi.http.routes.CalculatePriceForRangeDto] entity(as[CalculatePriceForRangeDto]) { ^ Have seen all related SO questions but nothing solved my issue.

It appeared I needed ActorMaterializer in scope in RoadMap trait. So, adding implicit val materializer: ActorMaterializer there solved the compilation problem.

I wish that error were a bit more descriptive ....

akka http, [error] /actors/Interpreter.scala:54: could not find implicit value for parameter um: akka.http.scaladsl.unmarshalling.Unmarshaller[String,model. Hi, I am using akka-http-circe and getting the following error: Error:(53, 83) could not find implicit value for parameter um: akka.http.scaladsl.unmarshalling.Unmarshaller[akka.http.scaladsl.model

Import these things.

import spray.json.RootJsonFormat
import spray.json.DefaultJsonProtocol._

Then have this in scope when you call entity(as[Client])

implicit val clientJsonFormat: RootJsonFormat[Client] = jsonFormat5(Client)

could not find implicit value for parameter um: akka , In Akka HTTP “Unmarshalling” means the conversion of a lower-level source object, e.g. a T] type FromRequestUnmarshaller[T] = Unmarshaller[ HttpRequest, T] type The process of unmarshalling does not have to support content negotiation For an example on how to use an unmarshaller on the server side, see for� Error: (26, 18) could not find implicit value for parameter um: akka.http.scaladsl.unmarshalling. FromRequestUnmarshaller [ Template ] entity(as[ Template ]){ ^ in MarshallingDirectives I found:

Unmarshalling • Akka HTTP, Akka HTTP's marshalling and unmarshalling infrastructure makes it rather easy to seamlessly convert community. See the list of current community extensions for Akka HTTP. and ToEntityMarshaller[T] for every type T that an implicit spray. json. application/json`, input)) val value: Source[Tweet, Any] = response.entity. Your code should be okay provided you have the right implicits in scope. If you have an implicit FlowMaterializer in scope then things should work as expected as this code that compiles shows: import akka.http.scaladsl.server.Route import akka.actor.ActorSystem import akka.stream.ActorFlowMaterializer import akka.http.scaladsl.model.StatusCodes._ import akka.http.scaladsl.server.Directives

JSON Support • Akka HTTP, The following examples show how to use akka.http.scaladsl.unmarshalling. You can vote up the ones you like or vote down the ones you don't like, and go to the original JsValue] { implicit ec: ExecutionContext => value => Future(value. mat: Materializer ): Future[ErrorOr[JValue]] = { // get encoding from response� could not find implicit value for parameter mat: akka.stream. ActorFlowMaterializer [error] sprayJsonUnmarshaller[ MyCaseClass ] I had an implicit FlowMaterializer in scope where I needed a ActorFlowMaterializer.

Scala Examples of akka.http.scaladsl.unmarshalling.Unmarshaller, Error:(70, 18) could not find implicit value for parameter um: akka.http.scaladsl. unmarshalling.FromRequestUnmarshaller[Server. Blueslip]� too many arguments for method props: (implicit ec: scala.concurrent.ExecutionContext)akka.actor.Props Ich habe versucht, implizite Parameter explizit zu machen, und es hat einwandfrei funktioniert, außer es ist ein bisschen gegen die übliche Praxis, den Ausführungskontext implizit zu übergeben.

Comments
  • Note that you'll need to import "com.typesafe.akka" %% "akka-http-spray-json" % "10.0.5" for SprayJsonSupport to be in scope. That being said, it didn't solved the issue for me.