API Gateway configuration to receive correct POST body as JSON

B

bozzmob

Guest
I am struggling with getting Lambda + API gateway working well.

This is my code-

exports.handler = async (event) => {
console.log("EVENT -> ", event.body)
let buff = new Buffer(event.body, 'base64');
let text = buff.toString('UTF-8');
console.log("TEXT -> ",text)
// TODO implement
const response = {
statusCode: 200,
body: JSON.stringify('Hello from Lambda!'),
};
return response;
};



I have referred to this answer, but, I don't see Integration Request in API Gateway.

here

What has to be done to get a proper JSON? I know I can use 3rd party npm libs. But, I prefer some fix at AWS end. I just want to use event.body which should return a JSON.

Continue reading...
 
Top