Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

452
Vistas
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 Respuestas
Responde la pregunta

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 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 Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda