I have to respond to https request with Json body in AWS Lambda API. So, I need to read first the body request and get some data and then to retreive values from external sourse(api) based on those data ans send response back.
I started with this:
exports.handler = async (event) => {
const id_ses = event.queryResult.outputContexts[0].name;
console.log(id_ses);
const res = {
statusCode: 200,
body: JSON.stringify(data),
};
console.log(res);
return res;
};
//var response = { .... json response
When I don't read request body i can send response.. but if i try to get data from the request body, I can't response after it means if I put this two lines
const id_ses = event.queryResult.outputContexts[0].name;
console.log(id_ses);
I can not output response to the requested side outside from Lambda... although I have good result in test console...
Any knowledge or some link where I can see sample would be nice....