Learn Courses My Dashboard

Error in your video "Getting Started with Vapor 4 Lesson 2"

Thread 1: Fatal error: Error raised at top level: PostgresNIO.PSQLError(base: PostgresNIO.PSQLError.Base.server(PostgresNIO.PostgresBackendMessage.ErrorResponse(fields: [Line: “725”, Message: “role “vapor_username” does not exist”, File: “miscinit.c”, Localized Severity: “FATAL”, Severity: “FATAL”, Code: “28000”, Routine: “InitializeSessionUserId”])))

I get this error around 24 minutes in the video, how to fix it? I tried the video multiple times, i get the same result but you guys dont

The error is saying that the username vapor_username doesn’t exist. This is created from the docker-compose.yml file. See code here

I had this happen before, and I fixed it by deleting all the docker container and recreating it.
I ran this command: docker system prune -a --volumes in the same directory as the Dockerfile
NOTE: this will delete ALL your docker containers and data for those containers, so use with caution.

And later, I also ran like every command from this site to make sure I deleted everything.

And then go back to the tutorials, and in the directory with the Dockerfile, try to again do the command docker compose up db (which will start up a new container)