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

361
Vistas
How do I see the full logs of a local invocation of a Lambda via SAM?

I am using the default HelloWorld example My code is:

let response;
exports.lambdaHandler = async (event, context) => {
    console.log(event);
    try {
        response = {
            'statusCode': 200,
            'body': JSON.stringify({
                message: 'hello world'
            })
        }
    } catch (err) {
        console.log(err);
        return err;
    }

    return response
};

Everything works as expected. I am starting it with sam local start-api or sam local start-api --debug

My questions, Where do I see the output of console.log(event);
Currently I can only see a {.
I if put there a string, like 'AAAAAAAA' I would see that in the terminal where I typed sam local start-api (as expected).

what am I missing so I can see full local logs?

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

0

In your code, put in JSON.stringify to convert the object to a string from logging,

console.log(JSON.stringify(event));

You can then see the logging in the terminal/command-prompt via

sam local start-api

Or have it log to a file with:

sam local start-api --log-file logfile.txt

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