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

511
Vistas
Test Lambda Locally (Lambda function calling another lambda function)

I am learning node and serverless architecture. To test my lambda function locally I am currently using lambda-local which has been working fine so far.

Now I have a function that invoke another lambda function, something like this:

    let lambda = new integration.myLambda.AWS.Lambda();
    let params = {
        FunctionName: 'my-other-function',
        InvocationType: 'RequestResponse',
        LogType: 'None',
        Payload: JSON.stringify(myEvent)
    };

    return new Promise((resolve, reject) => {

        lambda.invoke(params, function (error, data) {
            if (error) {
                console.log('error on invoke', error);
                reject({
                    statusCode: HttpStatus.INTERNAL_SERVER_ERROR,
                    message: error
                });

            } else {
                console.log('invoke success', data);
                resolve(JSON.parse(data.Payload));
            }
        });

    });

This bit of code does not work locally, but once deployed on aws it's working fine. However deploying to aws it takes about 2 mins. So I was wondering if there is a way to have this code run locally.

Any suggestions?

Thank you!

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

So personally I use serverless as my preferred framework for local, there's also a very promising looking project from atlassian called localstack here - I haven't actually tried the second one! Hope this helps.

over 4 years ago · Santiago Trujillo Denunciar

0

So I find out that all I need it to do was to export: accessKeyId and secretAccessKey.

Just for testing put it in code just above your invoke call. Then make sure you set them in a secure place.

I was exporting them

export ACCESS_KEY_ID=yourkey

export SECRET_ACCESS_KEY=yoursecretkey

Now I am using docker so I have them in a config file.

Hope this helps

over 4 years ago · Santiago Trujillo 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