1
votes

I am making API endpoint using Serverless, Lambda/API Gateway. But the request body is always encoded by base64. What is the reason?

1
Provide sample data - aviboy2006

1 Answers

0
votes

I didn't set respective body template. I want to get JSON data without setting respective body template.

I believe it's because of Lambda Proxy Integration.

Just solved problem with this.

let buff = Buffer.from(event.body, "base64");
let eventBodyStr = buff.toString('UTF-8');
let eventBody = JSON.parse(eventBodyStr);