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

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

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 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