Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

454
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!