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

129
Visualizações
Node MariaDB stuck on getConnection

I'm running mariadb locally and want to query for a few rows using the Node driver. I have the following code below that comes straight from the mariadb node docs. I've confirmed my server is up and running and that I can query from the CLI itself.

The weird thing is that the script doesn't fail or throw error. It just gets stuck at the await pool.getConnection() line. I even waited for like 5 minutes.

My server version is Server version: 10.7.3-MariaDB Homebrew and I'm using the 3.0.0 package version for Node https://www.npmjs.com/package/mariadb

const mariadb = require('mariadb');
const pool = mariadb.createPool({
        host: 'localhost',
        user: 'node',
        password: 'PWD',
        connectionLimit: 5,
        port: 3306,
        database: 'DB',
        acquireTimeout: 5000
});

(async () => {
        console.log('in iife');
        let conn;  
        try {
           console.log('awaiting conn');

           //This never gets reached..just gets stuck even after 5s
           conn = await pool.getConnection();
           console.log(conn);
           console.log('awaiting q');
           const rows = await conn.query("SELECT * FROM foo where id=1");
           console.log(rows);
        } catch (err) {
                throw err;
        } finally {
            if (conn) return conn.end();
        }

})();

I've actually tried this on two separate devices and have the same exact issue. Any ideas?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It was a red herring. Using dev tools to debug led me to realize there was a mundane runtime error in undeclared var. Red herring was that error was being caught and thrown. But bc this was being called as ad-hoc script, I was never aware of what the error was. Replacing the throw with a console.error led me to see error

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