EfficientDynamoDb icon indicating copy to clipboard operation
EfficientDynamoDb copied to clipboard

PutItem ToItemAsync always returns null

Open wjax opened this issue 3 years ago • 2 comments

Hello,

I am using your great library for one of my projects. I have difficulties to create objects and get feedback that they have been created correctly so decided to use ToItemAsync (With WithReturnValues) and ToResponseAsync.

None of them work as "I expected".

  • ToResponseAsync returns an object whose childs are all null. So no useful information
  • ToItemAsync complains when I set ReturnValues.AllNew telling me only AllOld and None should be used. However, no matter what I use, null is always returned

I have setup a small repo for you with a demo.

https://github.com/wjax/DynamoDbRepository.Playground

To note also that in the doc, it reads ToEntityAsync instead of the actual ToItemAsync

wjax avatar May 23 '22 13:05 wjax

Hey @wjax

ToItemAsync complains when I set ReturnValues.AllNew telling me only AllOld and None should be used.

DynamoDB doesn't allow to set ReturnValues.AllNew for PutItem because it makes no sense in the context of operation. If PutItem is completed successfully, your item is saved and equals the item you've passed in the request.

However, no matter what I use, null is always returned

There is a bug in parsing DDB response that is fixed in #191. In the new version, you'll be able to use either ToResponseAsync or ToItemAsync with ReturnValues.AllOld to get an item state before the update.

firenero avatar May 26 '22 17:05 firenero

Many thanks!

wjax avatar May 26 '22 20:05 wjax