Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for Dynamo Feature: ReturnValuesOnConditionCheckFailure #182

Open
vincent-ogury opened this issue Sep 21, 2023 · 1 comment
Open

Comments

@vincent-ogury
Copy link

Hi,

Can you add support of ReturnValuesOnConditionCheckFailure parameters in putItem,updateItem,batchWriteItem ...

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

When the API thrown an error with code = 'ConditionalCheckFailedException'
Then the err include an "Item" containing the document in the db:

const cli = new AWS.DynamoDB({region:'local', endpoint: process.env.MOCK_DYNAMODB_ENDPOINT})
try {
  await cli.putItem({TableName: 'X', Item: {_id:{S:'test'}, v:{N:"1"}}}).promise()
  await cli.putItem({TableName: 'X', Item: {_id:{S:'test'}, v:{N:"3"}}
    ReturnValuesOnConditionCheckFailure: 'OLD_OLD',
    ExpressionAttributeNames: {'#V' : 'v'},
    ConditionExpression: '#V = :V',
    ExpressionAttributeValues: {':V':{N:"2}}
  }).promise()
} catch (err) {
  console.debug(err.code, err.Item)
  // Item = { _id : {S: "test"}, v: {N: "1}}
}

It works when I use the real dynamodb directly, and failed with this module or the dynamodb local provided by amazon.
this feature were release in july this year.

Thanks

@kaspar-p
Copy link

kaspar-p commented Mar 6, 2024

As of December 14, 2023, DynamoDB Local supports this feature. Can it be supported here, too?
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocalHistory.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants