I'm developing an AWS lambda function with Python 3.6 and facing an odd scenario.
Locally, calling the function with python-lambda-local everything works fine.
In AWS, the snippet below raises an exception:
def handler(event, context):
data = event['body']
logger.info("###DATAAAAA BODY " + str(data))
origem = data.get('origem','')
Error:
AttributeError: 'str' object has no attribute 'get'
It seems that, locally, the object data is a dict. But in AWS it is a str.
datato beevent['body']. If that's a string, then you don't have a.get()method. Perhaps log the entire contents of the event and double-check what you're receiving?