App's DB connection timing out when trying to connect to Railway MySQL database
This ticket can be closed
Hi, I'm trying to use MySQL with my Node.js (Express.js) app.
I'm not sure if I'm specifying the variables correctly, but they reflect correctly when I console.log them. My app involves creating a pool for my app to run queries in.
When it runs a query, it takes a few seconds before returning a
Error: connect ETIMEDOUT
error. Am I doing something wrong?9 Replies
Project ID:
95a2bc67-6c87-48fb-8d39-5d7dca258f75
95a2bc67-6c87-48fb-8d39-5d7dca258f75
Can you give an example of the code? Does it work correctly locally with a local copy of mysql?
Yep, it works locally
database.js
This is where I run the query
This is the stdout in my Deploy Logs:
i remember that there's also
DB_PORT
Oh god
I swear if it's because I forgot about that variable
https://docs.railway.app/databases/mysql
Does mysql2 not let you pass the url?
Avoids needing to pass each part by itself.
I'd just use
MYSQL_URL
yeah i would do the same, i hate using separate parts
Project requirements 🥲
Anyways turns out it was the port, when I forked it and worked on it I never notice it used the default port
Edited it and now it works
Thanks for the help! @ImLunaHey @ThallesComH