Postgres Connection Error
My app is unable to connect with railway's postgres service.
Also, when I used
DATABASE_URL
dbgate error is -
Error: Connection terminated unexpectedly
at e.exports.<anonymous> (/Applications/DbGate.app/Contents/Resources/app.asar/packages/plugins/dbgate-plugin-postgres/dist/backend.js:17:175293)
at Object.onceWrapper (node:events:509:28)
at e.exports.emit (node:events:390:28)
at Socket.<anonymous> (/Applications/DbGate.app/Contents/Resources/app.asar/packages/plugins/dbgate-plugin-postgres/dist/backend.js:9:141124)
at Socket.emit (node:events:402:35)
at endReadableNT (node:internal/streams/readable:1343:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Please help π28 Replies
Project ID:
6df8fc82-10e0-4b56-ab0b-b2ce2d7e52b5
6df8fc82-10e0-4b56-ab0b-b2ce2d7e52b5
can you try restarting the database?
did restart, still same error in console and dbgate
Also, I cannot find a railway link
xxxx-xxx-production.up.railway.app
to my deployed app even after I do railway up
..is it because my db is unable to connect?restart the database, not your app
if you don't have a domain yet, go to the service settings and generate one
this is probably very basic - how should I restart my db?
depends on if you have a legacy database or a database service.
does your database have a volume?
Yes, my db has a volume
then you restart it the same way you restart a deployment
As I did here?
yes but restart the database, not your app
This is probably too much handholding, but please can you send me screenshots of steps β sorry for trouble
open the database and click this highlighted button in the 3 dot menu
Already did, same error
can you connect to the database locally with dbgate?
No, tried using DATABASE_URL but not working
did you try with dbgate?
Error: Connection terminated unexpectedly
at e.exports.<anonymous> (/Applications/DbGate.app/Contents/Resources/app.asar/packages/plugins/dbgate-plugin-postgres/dist/backend.js:17:175293)
at Object.onceWrapper (node:events:509:28)
at e.exports.emit (node:events:390:28)
at Socket.<anonymous> (/Applications/DbGate.app/Contents/Resources/app.asar/packages/plugins/dbgate-plugin-postgres/dist/backend.js:9:141124)
at Socket.emit (node:events:402:35)
at endReadableNT (node:internal/streams/readable:1343:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Error JSON: {}
Connection: {
"server": "***",
"engine": "postgres@dbgate-plugin-postgres",
"useDatabaseUrl": "***",
"sshMode": "userPassword",
"sshKeyfile": "***",
"databaseUrl": "***"
}
Platform: darwin
This is the error on dbgatedo you see any errors in the database logs?
of railway?
yes
no errors, build and deploy logs look okay
can you try again on a vpn?
what does this mean?
try connecting to the database while you're connected to a vpn
ohk, will try
so, I deleted the service and created a new one...seemed to work fine then, I was able to execute
yarn prisma db push
to update db. I was even able to connect with dbgate. But when I did railway up
from my local environment, the same error surfaced - database connection failed, dbgate connection failed.
ok, so I realized my app needs two services --- one postgres for db, another empty service to deploy my app. I was using db service for deployment as well which created trouble. Now with railway up
I am deploying to the second service (not db). This way, I am able to deploy my app and also get a railway provided url.
is this the right way to do things?I wasn't aware you where doing railway up into the database service, of course that would completely nuke the database.
yes, a database and another blank service for the app is the correct way to go, glad you could figure this out