Play 2.5 Migration Error: Custom Action with BodyParser: could not find implicit value for parameter mat: akka.stream.Materializer

Viewed 3024

I have a Play Framework application, version 2.4 migrating to 2.5, everything done ! but throw an error in my custom action with BodyParser,

 def isAuthenticatedAsync[A](parser: BodyParser[A])(f: => Long => Request[A] => Future[Result]) = {
Security.Authenticated(userId, onUnauthorized) { user =>
  Action.async(parser)(request => f(user)(request))
}

}

Use this:

def upload = isAuthenticatedAsync(parse.maxLength(5 * 1024 * 1024, parse.multipartFormData)) { userId => request =>
//Logger.info(s"")
request.body match {
  case Left(MaxSizeExceeded(length)) => Future(BadRequest(Json.toJson(ResultTemp("Your file is too large, we accept just " + length + " bytes!"))))
  case Right(multipartForm) =>

throw an error:

could not find implicit value for parameter mat: akka.stream.Materializer

[error] def upload = Action.async(parse.maxLength(5 * 1024 * 1024, parse.multipartFormData)) { request =>

1 Answers
Related