R
Railwayβ€’4mo ago
Edgar

at Connection._handleTimeoutError (/app/node_modules/mysql2/lib/connection.js:205:17)

Hello community, I am getting the following error when deploying my API. I am using the database of a dedicated server and in the HOST I am placing the IP, but it keeps showing me the following error: Error connecting to the database 🚨 Error: connect ETIMEDOUT
at Connection._handleTimeoutError (/app/node_modules/mysql2/lib/connection.js:205:17)

at listOnTimeout (node:internal/timers:569:17)

at process.processTimers (node:internal/timers:512:7) {

errorno: 'ETIMEDOUT',

code: 'ETIMEDOUT',

syscall: 'connect',

fatal: true

}
at Connection._handleTimeoutError (/app/node_modules/mysql2/lib/connection.js:205:17)

at listOnTimeout (node:internal/timers:569:17)

at process.processTimers (node:internal/timers:512:7) {

errorno: 'ETIMEDOUT',

code: 'ETIMEDOUT',

syscall: 'connect',

fatal: true

}
Please help!! 😦 it is my first time doing deploys of my application and I took into account Railway for this project.
No description
28 Replies
Percy
Percyβ€’4mo ago
Project ID: N/A
Brody
Brodyβ€’4mo ago
where is the database hosted?
Edgar
Edgarβ€’4mo ago
It is hosted on a quality server, the database is in MySQL language.
Brody
Brodyβ€’4mo ago
so you mean to say it is not hosted on railway?
Edgar
Edgarβ€’4mo ago
No, I am using directly the HOST output of the db Do I have to upload the db in Railway? Is it necessary?
Brody
Brodyβ€’4mo ago
is the database hosted on railway? (yes/no)
Edgar
Edgarβ€’4mo ago
No
Brody
Brodyβ€’4mo ago
what environment variables are you using in code when connecting to the database
Edgar
Edgarβ€’4mo ago
DB_PORT, DB_HOST, DB_USER, DB_PASSWORD, DB
Brody
Brodyβ€’4mo ago
do you have those set in your railway service variables?
Edgar
Edgarβ€’4mo ago
Yes, I have them configured in the same way as in my .env file.
Brody
Brodyβ€’4mo ago
have you whitelisted all IP addresses in your database host?
Edgar
Edgarβ€’4mo ago
whitelisted ? Is it a configuration file? Sorry if I ask too much, but I'm a noob at this. This is my first deploy
Brody
Brodyβ€’4mo ago
please look into whitelisting with your current database host
Edgar
Edgarβ€’4mo ago
Where do I find that?
Brody
Brodyβ€’4mo ago
you would need to contact your database host and ask them
Edgar
Edgarβ€’4mo ago
Hi, it's me again. I have made the corresponding changes to my database settings (including the whitelisted IP) but I still have the same problem.
Brody
Brodyβ€’4mo ago
please make sure all the environment variables are correct
Edgar
Edgarβ€’4mo ago
Yes, I made sure of that but it still shows the same error.
Brody
Brodyβ€’4mo ago
make sure you allow your app on railway to access your database
Edgar
Edgarβ€’4mo ago
I have the public app
Brody
Brodyβ€’4mo ago
not quite sure what that has to do in relation to what I've said
Edgar
Edgarβ€’4mo ago
Do you think it would be better to use a proprietary database model from railway? Instead of using my server's db
Brody
Brodyβ€’4mo ago
the databases arent proprietary in any way shape or form, they are regular bog standard postgres databases. but yes using them would make this so much easier.
Edgar
Edgarβ€’4mo ago
I have too many tables in the database that I want to copy to Railway, is there any way to upload my exported.sql?
Brody
Brodyβ€’4mo ago
pg_dump and pg_restore
Edgar
Edgarβ€’4mo ago
I'm using MySQL
Brody
Brodyβ€’4mo ago
mysql has tools to dump and restore a database too