New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot authenticate docker postgres database #8927
Comments
That the error message for From the screenshots in the related discussion #8925 it looks to me that the @alucardu Can you try to connect to the server from the same location you are trying to use Prisma? |
@janpio thanks a lot! I had installed postgres on my Windows machine as well. So "for some reason" prisma was using that instance of postgres instead of the one I had running docker. I deinstalled postgres from my Windows system and now everything is running as expected. |
The reason would probably be that Docker can not make its instance of Postgres available at Great you figured this out and it now works for you. |
I'm having similar issue but I'm not using docker. Instead it's a cloud server and it's mysql |
I am having the same issue. I am using it on my MacBook intel chip. I checked my activity controller if any instance of postgres is running and it is not running. |
I have the same issue, but I cannot find any postgres running on my machine.(using mac M1) |
What I had to do was uninstall postgres and then reinstall it, I think this is because a previous application had set it up and the traffic was diverted to that SQL server, but I didn't have the ability to shut down the other one |
I ran into a similar issue when trying out Postgres. I ended up following a guide which set a volume. Upon going into the postgres container I noticed that it was constantly restarting with a message about incorrect data (using v13 is incompatible with v15). Once I deleted the volume and restarted the container I could connect just fine. I also had to stop my postgres13 instance that was running as Prisma would try to connect to that. Current docker-compose: # Use root/example user/password credentials
version: '3.1'
services:
postgres:
image: postgres
restart: always
hostname: postgres
container_name: postgres
environment:
POSTGRES_DB: example
POSTGRES_USER: user
POSTGRES_PASSWORD: example
ports:
- 5432:5432
adminer:
image: adminer
hostname: adminer
container_name: adminer
restart: always
ports:
- 8080:8080
|
Edit: I'm silly, ignore.
|
That sounds like your Docker instance was actually listening at |
Yes you are right! I forgot to get back and delete the comment, somehow everything was spun up on the same port, and I'm an idiot 😅 |
Are you on Mac? I think there that port reuse is actually possible. |
Nah, i'm, on Windows... to be honest it's a Fly.io bug that you can proxy to an "already in use" port without an error message, that's where the confusion came in! |
@janpio had the same issue, thanks to you, it worked For me |
worked for me too. |
Thanks it worked for me 👏🏻 |
Bug description
Prisma cannot authenticate with a postgres database inside docker.
How to reproduce
create a yml file:
a
.env
file:DATABASE_URL="postgresql://username:mypassword@localhost:5432/college_db?schema=public"
and a
schema.prisma
file:run
docker-compose up
and then in a different terminal runnpx prisma db pull
Returns error:
Expected behavior
Prisma should be able to authenticate and connect to the server.
Prisma information
Environment & setup
Prisma Version
I've also read that you need to replace your docker service name (postgres) with the localhost in the url
So the URL would be this:
DATABASE_URL="postgresql://username:mypassword@postgres:5432/college_db?schema=public"
but this returns the error:The text was updated successfully, but these errors were encountered: