Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.1K
Visualizações
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}`);
    });
};
about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

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 },
    },
  });
about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda