Reputation: 91
I am working with a NodeJS Lambda function and when I invoke it I get this as the result:
{
"body": "{\"message\":\"Hello from Lambda!\"}"
}
It seems as if the response is not being parsed correctly, because according to what I've seen the response should just be the hello world string. This is the code I have with the function.
exports.handler = async (event) => {
// TODO implement
const response = {
body: JSON.stringify({
message: "Hello from Lambda!",
}),
};
return response;
};
Which is the default code AWS gives you when creating a function. Does anyone know what might be the issue here?
Upvotes: 1
Views: 453
Reputation: 238497
The return value is exactly what you return. If you just want to return "Hello from Lambda" then your function should be:
exports.handler = async (event) => {
return "Hello from Lambda!";
};
Upvotes: 1