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

453
Visualizações
Cannot connect to database stored on aws from Heroku or Replit websites. (mysql2, node.js)

Problem: My discord.js bot isn't connecting to the mysql database on aws. The bot is being hosted on replit and also on heroku but for some reason I can't connect to both. I have tried connecting to the database from my laptop and it worked fine, I even hosted the bot on my laptop to see if there was a problem with the code but it connected just fine, it even wrote data on the database.

edit: the pw and host are written like that because this is from replit and I stored those values on .env so no one would see it.

Error: (node 475) UnhandledPromiseRejectionWarning: Error: ETIMEDOUT at PromisePool.query

Here is the code I'm using:

async function connect(){
const mysql = require('mysql2/promise');


    const pool = mysql.createPool({
        host: process.env['host'],
        user: 'admin',
        password: process.env['chave'],
        database: 'prdcorridas_main',
        port: 3306,
        waitForConnections: true,
        connectionLimit: 20,
        queueLimit: 0

    },);

    return pool;
}
connect()

async function query(query){
    const conn = await connect();
    return await conn.query(query);
}

module.exports = {query}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I found the problem, it was just a human error probably due to my tiredness when creating the database.

Solution: I had forgotten to specify to the aws website the ip address of the machine hosting the bot because I purposely restricted the 'income access' to the ip addresses listed only.

about 4 years ago · Juan Pablo Isaza 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