2

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.

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Hi this worked! I had to hit deploy after saving the file thank you
@justinviola no problem. If the answer was helpful it's acceptance would be appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.