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

127
Vistas
NodeJs Postgres + AWS Lambda timeout even after successful client connect

Lambda Function:

const client = new Client({
    user: 'postgres',
    host: 'rds_host',
    database: 'dbname',
    password: 'db_password',
    port: 5432
});

exports.handler = async (event, context, callback) => {
    try {
        await client.connect();
        callback(null, "Connected Successfully");
    } catch (e) {
        callback(null, "Error");
    }
};

With this code my lambda always get a timeout error, if I get rid of the cliente.connect() line, it works fine.

The interesting part is that if I add a client.query with INSERT the command does work and the row is created at the DB, so why I get a timeout when the client.connect() is added and the connection works?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I'm pretty sure that when your handler function is async, it's expecting a promise to be resolved, so, instead of using the callback, I would just return "Connected Successfully";

Link to relevant docs

There's an example at this link where there's an async handler without the callback.

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