Lambda standalone from console

The event that you get in your lambda function from API, and the one used when you run the function from the console are different. The event from api passed to your function will have a fixed known format. But when you run the function from console, you are passing the event in the incorrect format, thus it all breaks.

You have to ensure that your event structure used when you run the code in console matches the event structure from the API format.