Cannot connect to database using supervisor port (5432) after change password
Hello, I built my own solution based on Supabase and it great success (~50 customer for now) and one day ...
I was streaming and I exposed
--db-url=PSQL_DSN by mistake and to fix that issue I changed password for many postgresql users (following this comment https://github.com/supabase/supabase/issues/22605#issuecomment-2455781878)
somehow after setting the new password to .env of supabase and restart the app back to normal but now I cannot anymore connect to database (
postgresql://<user>.<tenant>:<password>@<ip>:5432/postgres) with new or old password to supervisor default port
connecting to supervisor using PSQL DSN is important for me so I can push local changes to my production database ๐
regards,34 Replies
I'm getting
inside supervisor container I get
but I already changed password for user pgbouncer
should the .env be where the password is stored for database connections?
what is the command you are runnning
yes, the variable
POSTGRES_PASSWORD is there
you mean the command for password change?
hmm i'm not sure altering the users like that is a good idea. What guide were you following?
are you trying to connect to local or remote database?
remote database self-hosted in vm
I didn't find any offical guide and just followed: https://github.com/supabase/supabase/issues/22605#issuecomment-2455781878
GitHub
Also Add Password Changing Guidelines ยท Issue #22605 ยท supabase/s...
Improve documentation Link https://supabase.com/docs/guides/self-hosting/docker Describe the problem When password is changed like for postgres in .env , It causes an error when started again docke...
i'm going to try and take a look at this and get back to you though i'm not too experienced with self hosting supabase
Are the containers healthy after you made this change and recreated the instance
yes, they are healthy
`
the error only happen for supervisor/pooler
the application is up and working: https://suhol.ai
suhol.ai - ุณููู
ุญูู ุฃููุงุฑู ุฅูู ู
ุดุงุฑูุน ู
ูุธู
ุฉ ูู
ูุงู
ูุงุจูุฉ ููุชูููุฐ ู
ุน ุฃุฏุงุฉ ุชุญููู ุงูู
ุดุงุฑูุน ุงูู
ุฏุนูู
ุฉ ุจุงูุฐูุงุก ุงูุงุตุทูุงุนู. ูุงุฌูุฉ ุจุณูุทุฉ ูุณููุฉ ุงูุงุณุชุฎุฏุงู
.
Also the db?
yes, it working and accept all requests
And you recreated containers after updating password?
yes, all of container restarted
I got only this error when try to connect to database with old/new password:

I remember this guide working last time I had to update password. I'll test and get back to you.
Just to be sure you took down the containers using docker compose down and then ran
up again?it was just restart and I just tried down and up the container and still same issue
Ok I can reproduce the issue and I don't have a proper solution but a workaround. This seems to be an issue with supavisor.
- If I revert back to old password, then I can login again. But as you have exposed the password, this won't be of any help to you
- If I connect directly to db without supavisor in between then I can login to db
I cannot use both workarounds because as you said first solution is to use already exposed password which is insecure
second solution will not work with supabase cli
it will
you can use --db-url flag
yes, I'm using it but the database is exposed over supervisor
or do you mean open port 5432 from database directly?
exactly. supavisor too is using 5432. just comment out that line


I don't think that is safe
anyway, why supervisor behave like that?
If you were running migrations before, then you were already using port 5432 as port 6543 is transaction mode
don't know, this used to work before. maybe some version update messed up something
One other workaround but it involves downtime
backup and restore into a new instance
@inder that more advance even for me xD
I'm looking into this issue but other than these workarounds I don't have any solution currently
@inder did you reproduce the issue in latest versions of supavisor?
I've tried with version 2.5.1 to 2.6.2
no success
@Salem Yaslem ุณุงูู
ูุณูู
I finally have a solution
https://github.com/supabase/supabase/issues/22605#issuecomment-3323382144
Thank you, i will try it
@inder I just tried what you propose in your comment and still same issue
walk me through the steps
or even better run this script https://github.com/singh-inder/supabase-automated-self-host/blob/main/docker/update-db-pass.sh
add it inside docker directory
nvm, it works now! I just need to connect to database
_supabase instead of postgres
thank youNo problem. This was actually a bug. Thanks for opening the issue
In the future you can use the script to automate this
yes I will do that, thank you a lot