0
votes

I am getting the following error when accessing to a lambda connected to a dynamo table which function is to write on it. The GET method works fine, the problem happens with de PUT method.

ERROR] ClientError: An error occurred (ValidationException) when calling the PutItem operation: One or more parameter values were invalid: Missing the key customer_id in the itemTraceback (most recent call last): File "/var/task/create.py", line 12, in create return todoList.todoList().put_item(event,context) File "/var/task/todoList.py", line 112, in put_item
table.put_item(Item=item) File "/var/runtime/boto3/resources/factory.py", line 520, in do_action
response = action(self, *args, **kwargs) File "/var/runtime/boto3/resources/action.py", line 83, in call
response = getattr(parent.meta.client, operation_name)(*args, **params) File "/var/runtime/botocore/client.py", line 357, in _api_call return self._make_api_call(operation_name, kwargs) File "/var/runtime/botocore/client.py", line 676, in _make_api_call
raise error_class(parsed_response, operation_name)

Any ideas on how to solve it? Thank you

1
It's useful to include error messages and exceptions but you should also include the relevant parts of your source code.jarmod

1 Answers

1
votes

You are trying to create a new item (or in DynamoDB terms: put a new item) in the table.

The error states:

Missing the key customer_id in the item

That means that the item you are trying to put into your table is missing customer_id, as it is probably part of the hash or sort key.

To solve this set customer_id.