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
Percy12mo ago
Project ID: N/A
TheFriendinYou
TheFriendinYouOP12mo ago
N/A
Brody
Brody12mo ago
going to need more info, what kind of app is this
TheFriendinYou
TheFriendinYouOP12mo 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
Brody12mo ago
what client library are you using
TheFriendinYou
TheFriendinYouOP12mo ago
axios
Brody
Brody12mo ago
thats an http request library, we are talking about mysql
TheFriendinYou
TheFriendinYouOP12mo ago
oh mb, mysql2 npm package?
Brody
Brody12mo ago
are you releasing the connection after your query?
TheFriendinYou
TheFriendinYouOP12mo ago
no i am not maybe i should use createPool instead?
Brody
Brody12mo ago
are you currently using any kind of pool
TheFriendinYou
TheFriendinYouOP12mo ago
no i noticed in my code im using one instance of db.connect(), so maybe that causing issues?
Brody
Brody12mo 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
TheFriendinYouOP12mo ago
sorry
Brody
Brody12mo ago
sorry? you havent done anything wrong?
TheFriendinYou
TheFriendinYouOP12mo ago
its just that most of the other coding platform places are very inactive so im still looking for more places for help
Brody
Brody12mo 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