R
Railway•5mo ago
Jin

Databases not connecting after a failed payment

I have some services running on Railway for a long time but I missed the payment. I paid and restarted all services but the databases were not connecting, I have 3 of them. Kindly help
Solution:
tl;dr: add a 3 second sleep to the beginning of your start command and connect to the database over the private network
Jump to solution
76 Replies
Percy
Percy•5mo ago
Project ID: N/A
Jin
Jin•5mo ago
NA @Brody kindly check this out
Brody
Brody•5mo ago
#🛂|readme #5
Jin
Jin•5mo ago
what do you need ?
Brody
Brody•5mo ago
please read it
Jin
Jin•5mo ago
I have I am not sure what to look for
Brody
Brody•5mo ago
#5 read readme #5 ping
Jin
Jin•5mo ago
Okay, as i said earlier I have been trying to fix the db connection issue on my railway for about 6 hours now. They are 3 different services and they are in production. this affects our business.
Brody
Brody•5mo ago
are you on pro?
Jin
Jin•5mo ago
just checked, it's hobby
Brody
Brody•5mo ago
you should not be running a business on a hobby plan meant only for hobby projects, please upgrade to pro at your earliest convenience
Jin
Jin•5mo ago
understood can you see my actual problem in the first message of the thread ?
Brody
Brody•5mo ago
what is the state of your database deployment please tell me the state of the deployment
Jin
Jin•5mo ago
Active
Brody
Brody•5mo ago
send the deploy logs for postgres please - https://bookmarklets.up.railway.app/log-downloader/
Jin
Jin•5mo ago
do i upload here ?
Brody
Brody•5mo ago
yes thanks, show me a screenshot of the public networking try re-deploying the database
Jin
Jin•5mo ago
thanks
Brody
Brody•5mo ago
can you connect to it
Jin
Jin•5mo ago
after showing this for a while, it sometimes open up the data then it disconnects again
Brody
Brody•5mo ago
please use a proper database client like dbgate
Jin
Jin•5mo ago
it works before now, However, my interest is not seeing the db, but to make the connection work on the backend we are using. The connection issue breaks the backend
Brody
Brody•5mo ago
are you able to connect to the database with dbgate?
Jin
Jin•5mo ago
i have been able to connect using dbgate
Brody
Brody•5mo ago
have your application connect to the database via the private network
Jin
Jin•5mo ago
ok the application log prints the same issue and it's now crashed can't reach database server @ ....
Brody
Brody•5mo ago
please include the full error message what is your current start script
Jin
Jin•5mo ago
start is default The database itself fails to connect, so i don't think it is an issue from the application
Brody
Brody•5mo ago
I don't know what "start is default" means, please tell me what you have for your start script
Jin
Jin•5mo ago
i am not sure of that but we didnt put anything if it's the start command
Brody
Brody•5mo ago
please tell me what you have for your start script, if you are unfamiliar with node development, this can be found in your package.json
Jin
Jin•5mo ago
nest start
Brody
Brody•5mo ago
try changing that to sleep 3 && nest start
Jin
Jin•5mo ago
doesn't work.
Brody
Brody•5mo ago
please show me your scripts
Jin
Jin•5mo ago
okay, i will check but just to be clear, 1. if i make a new environment of the databse and enter it to the application, it will work. 2. The app deploys and start properly, there is. no start problem as we have been using it until I noticed subscription ended today
Jin
Jin•5mo ago
No description
Brody
Brody•5mo ago
please try my suggested fix
Jin
Jin•5mo ago
it doesn't work
Brody
Brody•5mo ago
im not seeing my suggested fix here?
Jin
Jin•5mo ago
i entered it directly on railway
Brody
Brody•5mo ago
please show me how you have implemented it
Jin
Jin•5mo ago
i edited this now, I am waiting for the build I edited the "start" to with the value you sent
Jin
Jin•5mo ago
No description
Brody
Brody•5mo ago
i had previously asked you to have your app connect to the database via the private network, please do that now
Jin
Jin•5mo ago
yes, i used it and it crashed, I just tried it now, same thing
Brody
Brody•5mo ago
please always show the error
Jin
Jin•5mo ago
it's the same thing, no differnce
Brody
Brody•5mo ago
every little bit of info helps im only trying to help you
Brody
Brody•5mo ago
thank you is the database in the same project?
Jin
Jin•5mo ago
what does in the same project mean ?
Brody
Brody•5mo ago
same railway project
Jin
Jin•5mo ago
no
Brody
Brody•5mo ago
please show a screenshot of your railway project
Jin
Jin•5mo ago
i just tried creating a db in the project now, i deleted it after that. I have 4 different services running. 1 worked well after making the payment but the remaining have issues with db connection
Brody
Brody•5mo ago
your database needs to be in the same project to use the private network
Jin
Jin•5mo ago
got it, what's to be done ?
Brody
Brody•5mo ago
move your bot service into the same project as the database
Jin
Jin•5mo ago
i don't see how to move it
Brody
Brody•5mo ago
its a manual process
Jin
Jin•5mo ago
i create a new database ?
Brody
Brody•5mo ago
i did not say that
Jin
Jin•5mo ago
manual is not clear
Brody
Brody•5mo ago
you need to deploy your bot service into the same project as the database
Jin
Jin•5mo ago
ok this trick works. Thanks!
Brody
Brody•5mo ago
no problem you do need to keep the sleep 3 please dont remove that or you will face issues again
Jin
Jin•5mo ago
okay. Why does it need the sleep 3
Brody
Brody•5mo ago
the private network is not available for the first 3 seconds
Jin
Jin•5mo ago
okay but what's wrong with the public network
Brody
Brody•5mo ago
nothing, you had something missconfigured, so its better to use the private network as that wont result in database <--> service egress fees
Jin
Jin•5mo ago
okay, but the database doesn't connect as well, so could that be from me ?
Brody
Brody•5mo ago
this would be due to a misconfiguration on your side, unfortunately i was not able to find out what that is, but either way, using the private network is much preferred
Jin
Jin•5mo ago
okay, thanks
Brody
Brody•5mo ago
no problem!
Solution
Brody
Brody•5mo ago
tl;dr: add a 3 second sleep to the beginning of your start command and connect to the database over the private network
Want results from more Discord servers?
Add your server