Reputation: 49
Hello I am testing out AWS Lambda and I keep getting the boilerplate output in my logs. I am new to AWS and this might be an easy fix but I have not been able to find a solution even in the docs.
Here is my index.js file
exports.handler = async (event) => {
// TODO implement
const response = {
statusCode: 200,
body: JSON.stringify('Different OutPut'),
};
return response;
};
And here is the log output in the lambda console:
Response:
{
"statusCode": 200,
"body": "\"Hello from Lambda!\""
}
Request ID:
"dc746181-ec98-4c8a-8e09-c6157da669cb"
I am expecting to have 'Different OutPut' as the body.
Also here are the role permissions:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "*"
}
]
}
Thank you for any advice.
Upvotes: 2
Views: 64
Reputation: 238081
If you keep getting Hello from Lambda!
then it probably means that you haven't deployed the function before you test/execute it.
You have to explicitly deploy (orange Deploy
button) function after each change in the code, so that changes take effect.
The other possibility is that you are executing wrong/old version of your function. In this case you have to explicitly select correct version if you have created any versions of your function.
Upvotes: 3