0

Below is a basic Lambda function with a slight modified response body (includes my first name instead of 'Lambda')

exports.handler = async (event) => {
    // TODO implement
    const response = {
        statusCode: 200,
        body: JSON.stringify('Hello from Isaiah!'),
    };
    return response;
};

Despite this, the response obj looks like

{
  "statusCode": 200,
  "body": "\"Hello from Lambda!\""
}

I will also say that console logging doesn't come up in cloud watch either. Why is this SO?

5
  • 1
    You didn't click the "deploy" button in the Lambda interface after you updated the code. Commented Dec 11, 2020 at 17:52
  • CloudWatch logs won't show up if you didn't give the Lambda function the appropriate CloudWatch logs IAM permissions. Commented Dec 11, 2020 at 17:53
  • Man, that's frustrating. Appreciate it mark, post this as the answer if you want the clout! Commented Dec 11, 2020 at 17:53
  • I actually have the right role defined, I just thought the deploy button did more than it actually does haha Commented Dec 11, 2020 at 17:54
  • do checkout whether the same aws lambda is opened in some other tab or somewhere..because of conflict it sometime shows this kind of output Commented Dec 11, 2020 at 18:03

1 Answer 1

1

If you are editing the Lambda function's code via the online editor you need to click the "deploy" button in the Lambda interface after you are done editing code.

For the missing logs, you need to make sure you give the Lambda function the appropriate IAM permission to create the CloudWatch logs.

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

Comments

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.