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

360
Visualizações
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 Respostas
Responde à pergunta

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