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

817
Visualizações
AWS API Gateway: why post request body is encoded base64?

Am using API gateway to trigger a Lambda function, using Lambda Proxy integration, however the request body is encoded base64, why is that? and how can I change it to be JSON to stringify JSON?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

That's because you are using Lambda Proxy Integration in API Gateway. If you use Lambda integration, it will be fine and you can get JSON.

Also you can change it to be JSON to stringify JSON with following method.

let buff = Buffer.from(event.body, "base64");
let eventBodyStr = buff.toString('UTF-8');
let eventBody = JSON.parse(eventBodyStr);
over 4 years ago · Santiago Trujillo Relatório

0

If I am understanding your question correct, you are sending non base64 encoded JSON payload as request to API gateway, however your Lambda is receiving it as base64 encoded string.

It seems that you are not setting application/json as your request content-type. You can see in this table how API gateway decides whether Integration Request Payload (last column) is Base64-encoded string or some other type.

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-payload-encodings-workflow.html

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