R
Railwayβ€’10mo 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β€’10mo ago
Project ID: N/A
Brody
Brodyβ€’10mo ago
where is the database hosted?
Edgar
EdgarOPβ€’10mo ago
It is hosted on a quality server, the database is in MySQL language.
Brody
Brodyβ€’10mo ago
so you mean to say it is not hosted on railway?
Edgar
EdgarOPβ€’10mo 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β€’10mo ago
is the database hosted on railway? (yes/no)
Edgar
EdgarOPβ€’10mo ago
No
Brody
Brodyβ€’10mo ago
what environment variables are you using in code when connecting to the database
Edgar
EdgarOPβ€’10mo ago
DB_PORT, DB_HOST, DB_USER, DB_PASSWORD, DB
Brody
Brodyβ€’10mo ago
do you have those set in your railway service variables?
Edgar
EdgarOPβ€’10mo ago
Yes, I have them configured in the same way as in my .env file.
Brody
Brodyβ€’10mo ago
have you whitelisted all IP addresses in your database host?
Edgar
EdgarOPβ€’10mo 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β€’10mo ago
please look into whitelisting with your current database host
Edgar
EdgarOPβ€’10mo ago
Where do I find that?
Brody
Brodyβ€’10mo ago
you would need to contact your database host and ask them
Edgar
EdgarOPβ€’10mo 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β€’10mo ago
please make sure all the environment variables are correct
Edgar
EdgarOPβ€’10mo ago
Yes, I made sure of that but it still shows the same error.
Brody
Brodyβ€’10mo ago
make sure you allow your app on railway to access your database
Edgar
EdgarOPβ€’10mo ago
I have the public app
Brody
Brodyβ€’10mo ago
not quite sure what that has to do in relation to what I've said
Edgar
EdgarOPβ€’10mo 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β€’10mo 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
EdgarOPβ€’10mo 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β€’10mo ago
pg_dump and pg_restore
Edgar
EdgarOPβ€’10mo ago
I'm using MySQL
Brody
Brodyβ€’10mo ago
mysql has tools to dump and restore a database too
Want results from more Discord servers?
Add your server