AWS Lambda Python 3.7 runtime exception logging

This is a bug in AWS Lambda. I noticed it mid-December and filed an issue; the response included the following: "I would like to let you know that this has been identified as a genuine issue and the Lambda team is currently working towards resolving it. But, unfortunately I do not have an ETA on when this issue will be resolved."

My solution was to revert back to python3.6 runtime until Amazon fixes it.


Yep, I've noticed it. To overcome I use a decorator.

def log_errors(func: Callable[[dict, dict], None]):
    def wrapper(*args, **kwargs):
        try:
            func(*args, **kwargs)
        except Exception as err:
            warning(traceback.format_exc())
            raise err

    return wrapper

Usage:

@log_errors
def handler(event, context):
...