Railway connection closing

Hi! I have this problem regarding railway's deployment. So far, deploying my application is fine, however after a day or at least in a few dozen hours, i get this error:
{
"message": "Can't add new command when connection is in closed state"
}
{
"message": "Can't add new command when connection is in closed state"
}
Anyone how this is caused? and how to prevent this from happening? Thank you.
17 Replies
Percy
Percy11mo ago
Project ID: N/A
TheFriendinYou
TheFriendinYou11mo ago
N/A
Brody
Brody11mo ago
going to need more info, what kind of app is this
TheFriendinYou
TheFriendinYou11mo ago
an app that is connected to azure mysql from a node.js backend. I usually have to redeploy to make it work again. i wonder if azure stops connections over a period of time
Brody
Brody11mo ago
what client library are you using
TheFriendinYou
TheFriendinYou11mo ago
axios
Brody
Brody11mo ago
thats an http request library, we are talking about mysql
TheFriendinYou
TheFriendinYou11mo ago
oh mb, mysql2 npm package?
Brody
Brody11mo ago
are you releasing the connection after your query?
TheFriendinYou
TheFriendinYou11mo ago
no i am not maybe i should use createPool instead?
Brody
Brody11mo ago
are you currently using any kind of pool
TheFriendinYou
TheFriendinYou11mo ago
no i noticed in my code im using one instance of db.connect(), so maybe that causing issues?
Brody
Brody11mo ago
then you should be closing the connections after you make the queries you are currently trying to re-used a closed connection for transparency, this isnt an issue with railway or azure, this is a code issue
TheFriendinYou
TheFriendinYou11mo ago
sorry
Brody
Brody11mo ago
sorry? you havent done anything wrong?
TheFriendinYou
TheFriendinYou11mo ago
its just that most of the other coding platform places are very inactive so im still looking for more places for help
Brody
Brody11mo ago
no worries at all, while coding help is a bit out of scope for these threads, im just trying to push you in the right direction
Want results from more Discord servers?
Add your server