R
Railway12mo ago
dan

Deployment Issues

Heyo! So recently I changed the repo of my discord bot and applied the same settings the previous repo was using. This new one has major code changes compared to the first one. My problem is that whenever I trigger a deploy/redeploy the only thing I get in the deployment logs is a database error, and nothing else. I replicated the same conditions on my laptop and everything works out just fine. No db issue and the bot connects instantly. I've ensured that everything Is the same so I really don't understand why It doesn't work anymore.
Solution:
change your start script in your package.json to
sleep 3 && node .
sleep 3 && node .
...
Jump to solution
21 Replies
Percy
Percy12mo ago
Project ID: bdf52ca3-6199-4fdc-b415-bc60d97ba135
dan
dan12mo ago
bdf52ca3-6199-4fdc-b415-bc60d97ba135
dan
dan12mo ago
That db error has happened in the previous repo as well, but was never an issue
Brody
Brody12mo ago
and you said that you can connect to this database locally just fine?
dan
dan12mo ago
Yep
Brody
Brody12mo ago
can you try to add a 3 second sleep before starting your app?
dan
dan12mo ago
That error has always been there for whatever reason, but I can connect just fine
Brody
Brody12mo ago
might be running into the network initialisation times
dan
dan12mo ago
Do you mind helping me with this? I’m quite unsure how to do this
Brody
Brody12mo ago
sure, what's your current start command?
dan
dan12mo ago
It’s the default one. npm run start Bot is in ts if that matters
Brody
Brody12mo ago
cool, what's your start script
dan
dan12mo ago
Build command is also default Pretty sure it’s node . If that’s what you mean *I’m not entirely fluent in English so I might not understand what you’re talking me through here and then. I apologise for that If I recall correctly, this also happened the first time I tried to deploy my old repo on railway. However, after I triggered another redeploy It seemed to fix itself
Brody
Brody12mo ago
you're doing great! that's what the start script in your package.json says?
dan
dan12mo ago
Yes, but there are other things included in the scripts
No description
dan
dan12mo ago
Don’t quite understand why this happens, even the first time with the original repo. Though it only happens once there; here it’s happening every time haha
Solution
Brody
Brody12mo ago
change your start script in your package.json to
sleep 3 && node .
sleep 3 && node .
dan
dan12mo ago
So just "sleep 3 && node ." Gotcha @Brody Thank you so much, it fully works now. I really appreciate it :)
Brody
Brody12mo ago
no problem, happy to help!
Want results from more Discord servers?
Add your server