-
Notifications
You must be signed in to change notification settings - Fork 634
Closed as not planned
Closed as not planned
Copy link
Labels
bugThis issue is a bug.This issue is a bug.p2This is a standard priority issueThis is a standard priority issue
Description
Checkboxes for prior research
- I've gone through Developer Guide and API reference
- I've checked AWS Forums and StackOverflow.
- I've searched for previous similar issues and didn't find any solution.
Describe the bug
When using the document client and setting ReturnValuesOnConditionCheckFailure: 'ALL_OLD'
, item attributes returned with ConditionalCheckFailedException
are not unmarshalled
Regression Issue
- Select this option if this issue appears to be a regression.
SDK version number
@aws-sdk/[email protected]
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v22.3.0
Reproduction Steps
Run the snippet below against a record that violates the condition expression, using your own values and attribute names if needed.
const client = DynamoDBDocumentClient.from(new DynamoDBClient());
try {
const result = client.send(
new UpdateCommand({
TableName: 'MyTable',
Key: { pk: 'pk', sk: 'sk' },
UpdateExpression: 'SET my_attribute = :attr',
ConditionExpression: 'attribute_exists(pk) AND owner_id = :ownerId',
ExpressionAttributeValues: { ':attr': 'test', ':ownerId': 'ownerId' },
ReturnValues: 'ALL_NEW',
ReturnValuesOnConditionCheckFailure: 'ALL_OLD',
}),
);
} catch (error) {
if (error instanceof ConditionalCheckFailedException) {
console.log(error.Item); // error.Item is unmarshalled
}
}
Observed Behavior
The record item returned along with the error is not unmarshalled
Expected Behavior
The record item returned along with the error should be unmarshalled
Possible Solution
Catch the error, unmarshall the item and rethrow
Additional Information/Context
No response
Metadata
Metadata
Assignees
Labels
bugThis issue is a bug.This issue is a bug.p2This is a standard priority issueThis is a standard priority issue