cant connect to pg locally
so im trying to connect to my postgres server locally from a python script using
asyncpg.create_pool
this has always worked for me in the past but its not working this time for some reason.
the env variables are all present.
i get socket.gaierror: [Errno 11001] getaddrinfo failed
. if you want me to send full traceback i can do that ig.
it works fine on railway idk it just doesnt work on my computer.
the env variables for the project on railway are variable references, and ive copied those to the local env file
project id: 1dfc4bb8-37ce-4e09-9723-387fa3324724
Solution:Jump to solution
you need to use the public host as the host and the public port as the port
20 Replies
Project ID:
1dfc4bb8-37ce-4e09-9723-387fa3324724
the pghost seems to be
railway.internal
and not viaduct.railway
like ive seen in the past
i did go to the pg server settings and find the public networking url which was viaduct.railway
but it gives me the same error
as i said before, the same script deploys fine on railway
the script actually didnt work on railway before using variable references but like im sure i copied them properly
What is love
i do not understand the problem
the pg database came out of sleep when i tried connecting so something must be have clicked
but it wont connect
the password is correct
the user is correct
the host is correct
???is the port correct?
well yeah
i tried the private one and the public one
the private one i got by going to the variables tab and copying PGPORT and PGHOST
and then public one i opened the
Railway provided variables
and copied the RAILWAY_TCP_PROXY_DOMAIN:RAILWAY_TCP_PROXY_PORT
for PGHOST and then RAILWAY_TCP_APPLICATION_PORT
for PGPORT
neither workyou have it pointing to the wrong port
should i point it to 5432
yep thats the port postgres is running on
i think even the first tcp proxy (which i didnt create) was running on the wrong port
cause it was 45117
anyways
that would have been something you changed at some point
still doing a getaddr info fail
Solution
you need to use the public host as the host and the public port as the port
yeah
you arent...
🙏
its working now
awsome
enabling app sleeping on pg and redis should be fine tho right?
as long as your client can handle retries
alr
i see
tysm
no problem