sequelize: ConnectionError [SequelizeConnectionError]: connect ETIMEDOUT

can anyone help me why, Sequelize Return error in any my app is working fine in php but my node js app its retrun error ConnectionError [SequelizeConnectionError]: connect ETIMEDOUT at ConnectionManager.connect (/var/www/cms.storymadeid.com/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:126:17) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async ConnectionManager._connect (/var/www/cms.storymadeid.com/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:318:24) at async /var/www/cms.storymadeid.com/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:250:32 { parent: Error: connect ETIMEDOUT at Connection._handleTimeoutError (/var/www/cms.storymadeid.com/node_modules/mysql2/lib/connection.js:178: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 (/var/www/cms.storymadeid.com/node_modules/mysql2/lib/connection.js:178:17) at listOnTimeout (internal/timers.js:557:17) at processTimers (internal/timers.js:500:7) { errorno: ‘ETIMEDOUT’, code: ‘ETIMEDOUT’, syscall: ‘connect’, fatal: true } } (node:4962) UnhandledPromiseRejectionWarning: SequelizeConnectionError: connect ETIMEDOUT at ConnectionManager.connect (/var/www/cms.storymadeid.com/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:126:17) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async ConnectionManager._connect (/var/www/cms.storymadeid.com/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:318:24) at async /var/www/cms.storymadeid.com/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:250:32 (Use node --trace-warnings ... to show where the warning was created) (node:4962) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:4962) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

any solution

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (1 by maintainers)

Most upvoted comments

const Sequelize = require(‘sequelize’) const fs = require(‘fs’) const path = require(‘path’) require(‘dotenv’).config() const certificatePath = path.join(__dirname, ‘/DigiCertGlobalRootCA.crt.pem’)

const serverCa = [fs.readFileSync(certificatePath, ‘utf8’)]

const sequelize = new Sequelize( process.env.DB, process.env.DB_USER, process.env.DB_PASSWORD, { host: process.env.DB_HOST, dialect: ‘mysql’, port: process.env.DB_PORT, dialectOptions: { ssl: { rejectUnauthorized: true, ca: serverCa } }, define: { timestamps: false, freezeTableName: true } } )

module.exports = sequelize

In our case upgrading node version from 10 to 14 solved the issue