R
Railway•6mo ago
matteo

Im having trouble connecting my postgres db

Database Connection We are unable to connect to the database over the public network. Can you connect using this command? PGPASSWORD=** psql -h viaduct.proxy.rlwy.net -U postgres -p 24399 -d railway when i run this command I get the following error: psql: error: connection to server at "viaduct.proxy.rlwy.net" (35.212.103.87), port # failed: server closed the connection unexpectedly I believe its an issue with how my .env variables are set up - but i can't seem to pin point where they are wrong: My app references the following: // Build the PostgreSQL connection string const dbConnectionString = { user: process.env.PGUSER '...', password: process.env.PGPASSWORD '...', databaseURL: process.env.DATABASE_URL '...', host: process.env.RAILWAY_TCP_PROXY_DOMAIN '...', port: process.env.RAILWAY_TCP_PROXY_PORT '...', database: process.env.PGDATABASE '...', }; pls help thanks!
20 Replies
Percy
Percy•6mo ago
Project ID: 7cd5abca-874d-4198-a1a4-2ee775a27807
matteo
matteo•6mo ago
7cd5abca-874d-4198-a1a4-2ee775a27807
thomas
thomas•6mo ago
Hello, did you recently migrate v1 -> v2? Is this a new database? Did change regions recently? This is likely related to the #🚨|incidents we called. The most recent updates will always be on our status page. After a fix we are back. Can you confrim @matteo ?
matteo
matteo•6mo ago
This is a new database - i can confirm once the issue is resolved @thomas . Is there any timing on the resolution? hi @thomas - i just tried again. i received the same error i was receiving earlier which was: psql: error: connection to server at "viaduct.proxy.rlwy.net" (35.212.103.87), port ** failed: received invalid response to SSL negotiation: H Any guidance would be much appreaciated
Brody
Brody•6mo ago
please don't ping team members, instead keep an eye out in #🚨|incidents
thomas
thomas•6mo ago
We had to re-call the incident I am sorry for the false hope. We rolled out a change are monitoring. @matteo
matteo
matteo•6mo ago
thx - still seeing the same issue "received invalid response to SSL negotiation: H". Is this the correct channel to get help with my specific issue?
thomas
thomas•6mo ago
Yes. So what happened to your database is that you rollout out a node app over your database service.
thomas
thomas•6mo ago
Railway
404 - Page not found
Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.
thomas
thomas•6mo ago
Databases V2 are just services. This is to help them integrate more tightly with things like private networking. Just so I can learn, do you know how this happened? I have never seen someone do this before It is not related to the issue however.
Brody
Brody•6mo ago
@matteo in the mean time, you can click the 3 dots on a previous deployment within the postgres service and click redeploy to bring the database back online
matteo
matteo•6mo ago
I just ran railway up from visual code for both postgres and my app i wonder if it could be an issue with my reference variables -- otherwise perhaps its how my app is configured
Brody
Brody•6mo ago
you may have linked to the postgres service instead of your apps service, either way, where you able to do get your database beck online with my instructions?
matteo
matteo•6mo ago
Nope
No description
Brody
Brody•6mo ago
did you redeploy an older deployment?
matteo
matteo•6mo ago
yes i tried and the build failed
Brody
Brody•6mo ago
postgres doesnt need to build anything, please try with this tool https://bookmarklets.up.railway.app/service-redeploy/
thomas
thomas•6mo ago
It's working now
matteo
matteo•6mo ago
yes, but when i deploy my current code to postgres i still get this same issue.
Brody
Brody•6mo ago
please stop deploying code to the postgres service you need to be deploying your code to a separate service, please make sure you do not have your cli linked to the postgres service