var databases = DatabaseConfig()
let databaseConfig = PostgreSQLDatabaseConfig(hostname: “localhost”, username: “vapor”, database: “vapor”, password: “password”)
let database = PostgreSQLDatabase(config: databaseConfig)
databases.add(database: database, as: .psql)
services.register(databases)
Gives the the following error:
[PostgreSQLError.trust: No password is required]
[Async] Warning: read triggered when input queue was empty, ignoring: error( PostgreSQL Diagnostic: FATAL: role “vapor” does not exist
@warplydesigned if you stop the docker container (docker stop postgres) do you still get the same error? I’ve seen this error before with people who’ve installed Postgres with brew or manually and have the service running locally as well as the Docker container.
@0xtim thanks that must be the issue. I’m on my other computer right now away from home but it worked on the MacBook I have here as described in the book.
I’ve got the same issue. I did set everything up as in the book, but for some reason I can’t get it to work. I always get this error:
Thread 1: Fatal error: Error raised at top level: PostgreSQL Error: No password is required
I already deleted every other docker image and PostgreSQL from my Mac, did the “Xcode Dance” (delete Derived Data, Clean and Clean Build Folder). Still nothing. It works in the cloud though.
Docker has somehow started two instances and always does for me? I am using the code of the book and it results in the same error. I can restart Docker as often as I want, but so far nothing in this thread helped me out. So sorry that I have to review this thread. This ist the result of the „lsof -i“.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
com.docke 50830 atrust 21u IPv4 0x4b76a8dee64ab571 0t0 TCP *:postgresql (LISTEN)
com.docke 50830 atrust 22u IPv6 0x4b76a8def606eab1 0t0 TCP localhost:postgresql (LISTEN)
Hey @sajonara how do you know it creates two instances? The output of lsof there shows the same instance connected over both IPv4 and IPv6. What does docker ps show?
Thx, @0xtim. I thought it does but those are just ipv4 and ipv6 for the same process, there are no other sessions as docker ps shows, but the error is persistent, and as it seems it is there for quite some time, regarding version history of the involved apps ^^.
Where should I start to debug? Because I tried different versions of macOS and Xcode… as I thought maybe it was the Beta version of one Xcode I used which resulted in this error, but it had nothing to do with it, it is just the same on several systems.
I googled the error message and found only a handful of results, one of them was this thread. I tried redoing the whole project and even upgrading postgresql, etc. So far I changed back to SQLite, and will check on the topic regularly, if a solution comes up.
@0xtim I looked for another installation of postgresql but I have none installed via brew. I checked that. The error message is identical to the one posted by @thedan84.
If I stop the Docker container it complains about not being able to connect to the postgresql db. So at least I know that it tries to connect.