User `postgresWaspDevUser` was denied access on the database
I try to use PostgreSQL database with docker.
i have a terminal process in which i ran the command wasp start db.
In another terminal, I started wasp with wasp start, but I get the following outputs:
Terminal 1:
wasp start db
2024-06-13 22:43:01.339 UTC [1] LOG: database system is ready to accept connections
2024-06-13 22:43:41.772 UTC [33] FATAL: no pg_hba.conf entry for host "192.168.65.1", user "postgresWaspDevUser", database "ServiceConnect-5c2be627cd", no encryption
2024-06-13 22:43:44.538 UTC [34] FATAL: no pg_hba.conf entry for host "192.168.65.1", user "postgresWaspDevUser", database "ServiceConnect-5c2be627cd", no encryption
Terminal 2:
π --- Setting up database... -----------------------------------------------------
[ Db !] Error: P1010
[ Db !]
[ Db !] User
postgresWaspDevUser
was denied access on the database ServiceConnect-5c2be627cd.public
[ Db !]
[ Db ] Environment variables loaded from .env
[ Db ] Prisma schema loaded from ../db/schema.prisma
[ Db ]
[ Db ] β Generated Prisma Client (4.16.2 | library) to ./../../../node_modules/@prisma/client in 44ms
[ Db ] You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
[ Db ]
[ Db ] import { PrismaClient } from '@prisma/client'
[ Db ] const prisma = new PrismaClient()
[ Db ]
How can I fix it?3 Replies
Hi @OrBlatt. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the error messages you provided, it seems like the user
postgresWaspDevUser
is denied access to the database ServiceConnect-5c2be627cd.public
. This could be due to a variety of reasons such as incorrect database credentials, incorrect database configuration, or issues with the PostgreSQL setup.
One of the error messages mentions no pg_hba.conf entry for host "192.168.65.1", user "postgresWaspDevUser", database "ServiceConnect-5c2be627cd", no encryption
. The pg_hba.conf
file controls client authentication. This file is read on start-up and when the main server process receives a SIGHUP signal. If you edit the file on an active system, you will need to signal the postmaster (using pg_ctl reload
, calling the SQL function pg_reload_conf()
, or using kill -HUP
) to make it re-read the file.
You might need to update your pg_hba.conf
file to include an entry for the host "192.168.65.1", user "postgresWaspDevUser", and database "ServiceConnect-5c2be627cd".
Unfortunately, the knowledge sources provided do not contain specific instructions on how to update the pg_hba.conf
file or how to troubleshoot this specific issue. I would recommend checking the PostgreSQL and Docker documentation or reaching out to the Wasp community for further assistance.
Please note that it's important to ensure that your Docker setup is running correctly as Wasp uses Docker to run the PostgreSQL database. In one of the knowledge sources (https://github.com/wasp-lang/wasp/issues/1135), a similar issue was reported where the Docker daemon was not running, leading to a failure in starting the database.
Also, ensure that the database exists and is accessible. In some of the knowledge sources (https://github.com/wasp-lang/wasp/issues/787), users reported errors due to the database not existing at the specified path.
Lastly, ensure that the Prisma Client is correctly generated and can be used in your code as indicated in the knowledge sources (https://github.com/wasp-lang/wasp/issues/1579).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @OrBlatt, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?Wohooo @OrBlatt, you just became a Waspeteer level 1!
By looking at pg_hba.conf i see this
TYPE DATABASE USER ADDRESS METHOD
"local" is for Unix domain socket connections only
local all all trust
IPv4 local connections:
host all all 127.0.0.1/32 trust
IPv6 local connections:
host all all ::1/128 trust
Allow replication connections from localhost, by a user with the
replication privilege.
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
How can i add the interal IP address the wasp client was using (this time 192.168.65.1)?
@kapa.ai
I added the following line to pg_hba.conf, restarted the database via docker and it worked
host all all 192.168.65.1/32 trust