99x/dynamodb-localhost

local DynamoDB deleteItem behaves different compared to AWS DynamoDB

bilaal-s opened this issue · 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 serverless-dynamo-db@0.2.37 which pulls in dynamodb-localhost@0.0.7

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"}

Is this issue still opened?