0

I am trying to deploy my app using Nodejs, MySQL with sequelize as ORM on railway platform. But I saw this error: ConnectionError [SequelizeConnectionError]: connect ETIMEDOUT at ConnectionManager.connect (/workspace/node_modules/sequelize/dist/lib/dialects/mysql/connection-manager.js:102:17) at processTicksAndRejections (node:internal/process/task_queues:96:5) ... my database config like this:

const Sequelize = require('sequelize');
const path = require('path');
require('dotenv').config({path: path.join(__dirname, '../','.env')});

const sequelize = new Sequelize(process.env.DB_DATABASE, process.env.DB_USER, process.env.DB_PASS, {
    dialect: 'mysql',
    host: process.env.DB_HOST,
    port: process.env.DB_POST,
}, {
    define: {
       freezeTableName: true, 
    }
});
module.exports = sequelize;
Hung Vo
  • 66
  • 1
  • 10
  • It seems that the server is not able to connect to the database, there are multiple causes of this - The first check if the database is up, other might be you might have whitelisted IP's and you need to add IP of the server in the list of whitelisted IP's – Soham Lawar Jan 20 '22 at 04:47

1 Answers1

0

Set NODE_ENV environment variables in .env files.

Hung Vo
  • 66
  • 1
  • 10