I`m Trying to connect to Azure Mysql using
const sequelize = new Sequelize(
config.environment.db.db_one.name,
config.environment.db.db_one.user,
config.environment.db.db_one.pass, {
host: config.environment.db.db_one.host,
port: config.environment.db.db_one.port,
dialect: 'mysql',
define: {
freezeTableName: true
},
ssl: true,
dialectOptions: {
ssl:{
ca: fs.readFileSync(path.resolve('db', "DigiCertGlobalRootCA.crt.pem"))
}
}
});
On the server, there are a DigiCertGlobalRootCA.crt.pem file under "db" folder.
On localhost, my application works fine, but on Azure the app continuously crash and returns this error when I run node index.js
with KUDU bash
ConnectionError [SequelizeConnectionError]: connect ETIMEDOUT
at ConnectionManager.connect (/home/site/wwwroot/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:102:17)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async ConnectionManager._connect (/home/site/wwwroot/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:220:24)
at async /home/site/wwwroot/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:174:32
at async ConnectionManager.getConnection (/home/site/wwwroot/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:197:7)
at async /home/site/wwwroot/node_modules/sequelize/lib/sequelize.js:305:26
at async Sequelize.authenticate (/home/site/wwwroot/node_modules/sequelize/lib/sequelize.js:457:5) {
parent: Error: connect ETIMEDOUT
at Connection._handleTimeoutError (/home/site/wwwroot/node_modules/mysql2/lib/connection.js:205:17)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7) {
errorno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
syscall: 'connect',
fatal: true
},
original: Error: connect ETIMEDOUT
at Connection._handleTimeoutError (/home/site/wwwroot/node_modules/mysql2/lib/connection.js:205:17)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7) {
errorno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
syscall: 'connect',
fatal: true
}
}
❌ Error connecting to database!
Other screenshot from "Availability and Performance" section
What's wrong?