I have a simple Python function on AWS Lambda that just puts some data into a DynamoDB table and as far as I can tell, I'm following the correct format as per the Boto3 documentation for the put_item() function. I'm getting the following error that I can't seem to debug:
"errorMessage":
"Parameter validation failed:\nInvalid type for parameter
Item.GSRResults.L[0], value: 3.8, type: <class 'float'>, valid types: <class 'dict'>
\nInvalid type for parameter Item.GSRResults.L[1], value: 3.4, type: <class 'float'>, valid types: <class 'dict'>\... snip...
\nInvalid type for parameter Item.GSRResults.L[9], value: 3.3, type: <class 'float'>, valid types: <class 'dict'>",
"errorType": "ParamValidationError",
"stackTrace": [
[
"/var/task/index.py",
39,
"upload_test",
"Item=item"
],
Here is the Python function:
def upload_test(event, context):
if event['httpMethod'] == 'POST':
info = event['body']
item = info['Item']
return respond(None, dynamo.put_item(
TableName="TestResults",
Item=item))
This is the JSON I am sending:
{
"body": {
"Item": {
"UID": {
"S": "U999999"
},
"PID": {
"S": "P444444"
},
"GSRResults": { "L": [3.8,3.4,3.3,2.8,1.3,3.2,4.3,2.1,3.2,3.3] }
}
},
"httpMethod": "POST"
}