-
Notifications
You must be signed in to change notification settings - Fork 643
Closed
Labels
guidanceGeneral information and guidance, answers to FAQs, or recommended best practices/resources.General information and guidance, answers to FAQs, or recommended best practices/resources.response-requestedWaiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.
Description
Describe the bug
Incorrect type on ExpressionAttributeValues or UpdateItemCommand not unmarshalling ExpressionAttributeValues properly.
Your environment
Lambda NODEJS_14_X
SDK version number
@aws-cdk/aws-dynamodb@1.117.0
Is the issue in the browser/Node.js/ReactNative?
Node.js
Steps to reproduce
If you pass marshalled values to ExpressionAttributeValues, it inserts them like maps
E.g.:
const command = new UpdateItemCommand({
TableName: this.tableName,
Key: marshall({
PK: `CANDLESTICK#${candlestick.symbol}`,
SK: candlestick.persistenceKey,
}),
UpdateExpression, // this is in form "set #key_test1 = :test1, #key_test2 = :test2"
ExpressionAttributeValues: marshall(attributeValues), // attributeValues is of type Record<string, string>.
ExpressionAttributeNames: attributeNames,
})If you do it like that, it inserts the values correctly, but there's a ts error, it expects marshalled values:
const command = new UpdateItemCommand({
TableName: this.tableName,
Key: marshall({
PK: `CANDLESTICK#${candlestick.symbol}`,
SK: candlestick.persistenceKey,
}),
UpdateExpression,
ExpressionAttributeValues: attributeValues, // Error here
ExpressionAttributeNames: attributeNames,
})The problem is only with ExpressionAttributeValues, ExpressionAttributeNames already accepts { [key: string]: string } and works fine
Expected behavior
Either ExpressionAttributeValues needs to expect a type of { [key: string]: string }, or should unmarshall the values to properly insert into the db
Metadata
Metadata
Assignees
Labels
guidanceGeneral information and guidance, answers to FAQs, or recommended best practices/resources.General information and guidance, answers to FAQs, or recommended best practices/resources.response-requestedWaiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.

