I have the following Lambda function. I need to return some custom html when the function is called.
I tried:
exports.handler = async (event, context, callback) => {
const response = {
statusCode: 200,
headers: {
'Content-Type': 'text/html',
},
body: String("Hi there !"),
};
return response;
}
But when invoking the function, I'm getting the following error : The Lambda function returned an invalid entry in the headers object: Each header entry in the headers object must be an array. We can't connect to the server for this app or website at this time.
I took the code from AWS blueprint :
Original code from AWS :
What am I doing wrong?