Skip to content Skip to sidebar Skip to footer

Lambda + Python + Exit Code

I've encountered an issue with a simple AWS Lambda function written in Python. When I run my Lambda function, my code is running as expected, the result is correct, but still ends

Solution 1:

Short

Yes, remove the sys.exit(0) at the end of your code, that should do it :-)


Longer

By doing sys.exit(0) you actually stop the process running your code in the Lambda Function. And this is not expected by the executor.

I assume the handler of a Lambda Function is actually run from within AWS's framework. Hence you already are in a python process, and your handler is called somewhere in AWS's code. So if you exit the process, you actually short-cut AWS's framework, which cannot handle the resolution of the Lambda's execution.

Post a Comment for "Lambda + Python + Exit Code"