• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

1.1K
Vistas
error: Unable to connect to the database:, SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:5432

I'm trying to run node JS project by the running the command nodemon app.js, but i'm getting this error

"error: Unable to connect to the database:, SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:5432". 

Redis is up and running, still this error occurs. I don't have Postgres installed. Could that be a problem?

const sequelize = new Sequelize('postgres://manishrana:12345@localhost:5432/tutorial', {
  logging: false,
  define: {
    freezeTableName: true,
  },
  dialect: 'postgres',
  protocol: 'postgres',
  /* dialectOptions: {
      ssl: {
        require: false,
        rejectUnauthorized: false,
      },
      trim: true,
    }, */
  pool: {
    max: 5,
    min: 0,
    acquire: 30000,
    idle: 10000,
  },
});
const connectToDb = async () => {
  await sequelize
    .authenticate()
    .then((response) => {
      //console.log(response);
      logger.info('Connection has been established successfully.');
    })
    .catch((err) => {
      logger.error(`Unable to connect to the database:, ${err}`);
    });
};
almost 3 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

Please try this below way to initialize your connection of Sequelize

const sequelize = new Sequelize(url, {
    dialect: 'postgres',
    logging,
    ssl: false,
    dialectOptions: {
      ssl: { rejectUnauthorized: false },
    },
  });
almost 3 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda