Skip to content

Unknown key - no errorr?

0

This code works fine as long as there is a row in the table with the given key. However if a key ('email' here) is given for which no corresponding row exists, no error occurs, instead 'data' is an empty object ({}).

asked 6 years ago357 views
1 Answer
0

Hi,

I believe you are performing GetItem API on your DynamoDB table. Please correct me if I am mistaken here.

As per GetItem API call, it is expected that if the item does not exist for that primary key then it returns empty response.

Excerpt from documentation:

The GetItem operation returns a set of attributes for the item with the given primary key. If there is no matching item, GetItem does not return any data and there will be no Item element in the response.

Reference: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_GetItem.html

Hope it helps you.
Should you have any other concerns, do let us know. We'd be happy to help you.

AWS
answered 6 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.