Domanda

Yesterday I pushed an update to my Heroku application but the online version does not seem to execute the most recent code. Specifically, a new route I added results in an "Action not found" error visible here and the Akka job I schedule in Global.onStart is not started. It is not writing to the log at least.

My conf/routes file contains line

GET     /json/matches               controllers.FeedDaemon.matches()

The corresponding Controller exists and implements this action

def matches = Action { implicit request =>
    Ok(Cache.get(keyMatches) match {
      case Some(o)  => o.asInstanceOf[String]
      case None => ""
    })
}

Needless to say, it works locally. The heroku build did not report any errors and just went through.

I'm using play 2.2.2. My application contains a git submodule and is an sbt multi project build. Heroku detects the git submodule though. If the multi project were the problem, I'd expect build errors or ClassNotFoundExceptions though.

È stato utile?

Soluzione

The answer was pretty simple. In versions before 2.2, the play framework created the startup script at location target/start so your Heroku Procfile would have looked like

web: target/start -Dhttp.port=$PORT $JAVA_OPTS

This changed in Play 2.2 and the script is now at location target/universal/stage/bin/foo so your Procfile should look like this

web: target/universal/stage/bin/foo -Dhttp.port=$PORT $JAVA_OPTS

This has also been explained in this SO answer

In my case, the old application was started because the build output was never cleaned, so I successfully started the old version after building the new one instead of getting a target/start file not found error.

The heroku-repo plugin let me clear the build cache, which lead to the target/start file not found error, which let to the solution.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top