Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Lambda function is not updating in basic test environment

I'm trying to set up a very basic AWS Lambda script, but I struggle to get the AWS Lambda Test functionality to recognize the changes I make.

To setup the simplest possible test, I created a new AWS Lambda function for Python 3.7. I then make a simple change in the code as below, add a test output and run Test:

import json

def lambda_handler(event, context):
    # TODO implement
    return {
        'statusCode': 200,
        'body': json.dumps('I changed this text')
    }

I've verified that Version: is set to $LATEST - yet when I run the test, there is no change in my output - it keeps returning the original code output. Further, if I try to export the function, I get the original code - not my updated code above (despite having saved it).

I realize this seems very basic, but I wanted to check if others have experienced this as well.

like image 913
mfcss Avatar asked Nov 03 '20 19:11

mfcss


2 Answers

Based on feedback, it seems hitting Deploy is required in order to be able to test the updated function

like image 195
mfcss Avatar answered Sep 20 '22 21:09

mfcss


Even with hitting deploy, there's a definite delay. Try adding a print statement and hitting deploy and then testing. This will show that it often doesn't accept the new code right away. EXTREMELY frustrating for debugging. I have to literally refresh my lambda console page to get the changes to take.

like image 21
Strider Avatar answered Sep 20 '22 21:09

Strider