Play evolutions throwing error when trying to run it for the first time

Open
#600 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
28/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
postgresql, scala
Domain
backend, databases

Research direction

Start by reproducing the first-startup failure against PostgreSQL, then trace the evolution lookup through DatabaseEvolutions in EvolutionsApi.scala and ApplicationEvolutions.scala. Compare the visible play_evolutions table with the connection and schema used by that lookup; done means the initial server start can read the table without the reported relation error.

Written by the indexing model from the issue text.

Description

Error: [PSQLException: ERROR: relation "play_evolutions" does not exist Position: 8].
I can see the table play_evolutions in the db. Play does create this table on starting the server.

{"timestamp":"2021-07-13T08:40:29.320Z","level":"ERROR","thread":"play-dev-mode-akka.actor.default-dispatcher-7","logger":"play.api.http.DefaultHttpErrorHandler","message":"

! @7kc2k4hep - Internal server error, for (GET) [/] ->
 ","context":"default","exception":"play.api.PlayException: Execution exception[[PSQLException: ERROR: relation "play_evolutions" does not exist
  Position: 51]]
	at play.api.http.HttpErrorHandlerExceptions$.$anonfun$convertToPlayException$3(HttpErrorHandler.scala:388)
	at scala.Option.getOrElse(Option.scala:202)
	at play.api.http.HttpErrorHandlerExceptions$.convertToPlayException(HttpErrorHandler.scala:388)
	at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:373)
	at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:264)
	at play.core.server.Server$$anonfun$handleErrors$1$1.applyOrElse(Server.scala:109)
	at play.core.server.Server$$anonfun$handleErrors$1$1.applyOrElse(Server.scala:105)
	at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:37)
	at play.core.server.Server$.getHandlerFor(Server.scala:129)
	at play.core.server.AkkaHttpServer.handleRequest(AkkaHttpServer.scala:317)
	at play.core.server.AkkaHttpServer.$anonfun$createServerBinding$1(AkkaHttpServer.scala:224)
	at akka.stream.impl.fusing.MapAsync$$anon$30.onPush(Ops.scala:1297)
	at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:541)
	at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:495)
	at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:390)
	at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:625)
	at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:502)
	at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:600)
	at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:775)
	at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:790)
	at akka.actor.Actor.aroundReceive(Actor.scala:537)
	at akka.actor.Actor.aroundReceive$(Actor.scala:535)
	at akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:691)
	at akka.actor.ActorCell.receiveMessage(ActorCell.scala:579)
	at akka.actor.ActorCell.invoke(ActorCell.scala:547)
	at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:270)
	at akka.dispatch.Mailbox.run(Mailbox.scala:231)
	at akka.dispatch.Mailbox.exec(Mailbox.scala:243)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175)
Caused by: org.postgresql.util.PSQLException: ERROR: relation "play_evolutions" does not exist
  Position: 51
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2553)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2285)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:323)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:473)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:393)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:322)
	at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:308)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:284)
	at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:236)
	at com.zaxxer.hikari.pool.ProxyStatement.executeQuery(ProxyStatement.java:111)
	at com.zaxxer.hikari.pool.HikariProxyStatement.executeQuery(HikariProxyStatement.java)
	at play.api.db.evolutions.DatabaseEvolutions.executeQuery(EvolutionsApi.scala:336)
	at play.api.db.evolutions.DatabaseEvolutions.databaseEvolutions(EvolutionsApi.scala:146)
	at play.api.db.evolutions.DatabaseEvolutions.scripts(EvolutionsApi.scala:118)
	at play.api.db.evolutions.DatabaseEvolutions.scripts(EvolutionsApi.scala:133)
	at play.api.db.evolutions.DefaultEvolutionsApi.scripts(EvolutionsApi.scala:98)
	at play.api.db.evolutions.ApplicationEvolutions$.$anonfun$runEvolutions$1(ApplicationEvolutions.scala:205)
	at play.api.db.evolutions.ApplicationEvolutions$.withLock(ApplicationEvolutions.scala:231)
	at play.api.db.evolutions.ApplicationEvolutions$.runEvolutions(ApplicationEvolutions.scala:201)
	at play.api.db.evolutions.EvolutionsWebCommands.$anonfun$handleWebCommand$4(ApplicationEvolutions.scala:517)
	at play.api.db.evolutions.EvolutionsWebCommands.$anonfun$handleWebCommand$4$adapted(ApplicationEvolutions.scala:512)
	at scala.collection.immutable.List.foreach(List.scala:312)
	at play.api.db.evolutions.EvolutionsWebCommands.handleWebCommand(ApplicationEvolutions.scala:512)
	at play.core.DefaultWebCommands.$anonfun$handleWebCommand$1(WebCommands.scala:42)
	at scala.collection.immutable.Stream.flatMap(Stream.scala:195)
	at play.core.DefaultWebCommands.handleWebCommand(WebCommands.scala:42)
	at play.api.http.DefaultHttpRequestHandler.$anonfun$handlerForRequest$4(HttpRequestHandler.scala:223)
	at scala.Option.flatMap(Option.scala:284)
	at play.api.http.DefaultHttpRequestHandler.handlerForRequest(HttpRequestHandler.scala:222)
	at play.core.server.Server$.getHandlerFor(Server.scala:126)
	... 23 common frames omitted
"}
Dominant language
Scala
Stars
794
Forks
272
Avg merge
1d 8h
Merged PRs (30d)
17

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from playframework/play-slick

All issues in playframework/play-slick

Similar issues

More Scala issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.