dynamodb-localhost icon indicating copy to clipboard operation
dynamodb-localhost copied to clipboard

local DynamoDB deleteItem behaves different compared to AWS DynamoDB

Open bilaal-s opened this issue 5 years ago • 1 comments

We have found in our use of DynamoDB local that the response from real AWS DynamoDB and Local DynamoDB are different when you attempt to delete data which does not exist. When using DynamoDB local the callback for <DynamoDbInstance>.deleteItem is called with a non-null value for the data parameter, however, for real AWS DynamoDB the callback is called with null for the data parameter.

We use dynamodb-localhost through serverless-dynamodb-local. We use [email protected] which pulls in [email protected]

Here is a representation of how we are exuting the deleteItem command:

var params = {
  Key: invalidKey,        // key that does not exist 
  TableName: "validTable" // table exists
 };
 dynamodb.deleteItem(params, function(err, data) {
 // data here should be null, which is the correct AWS behaviour
   if (err) console.log(err, err.stack);
   else     console.log(data); 
 });

When the data parameter is not null, dynamodb local responds with the following:

{"ConsumedCapacity":{"TableName":"validTable","CapacityUnits":1},"LOG_ID":"cqg6"}

bilaal-s avatar Sep 03 '19 08:09 bilaal-s

Is this issue still opened?

BLasan avatar Jun 13 '20 11:06 BLasan