table.update(
partitionKey = "some-partition-key",
update = Expression(
"REMOVE #x1",
Map("#x1" -> "someAttribute"),
Map.empty
)
)
This will result in the following error:
software.amazon.awssdk.services.dynamodb.model.DynamoDbException: ExpressionAttributeValues must not be empty
If I understand correctly you shouldn't set the expressionAttributeValues to an empty collection, but rather not set it at all in that case. I guess that probably the same issue can occur for expressionAttributeNames.
Essentially it's a bug in the aws SDK imho.
A workaround I found for now is adding a condition that should always be true, because the names and values will be merged with those of the update:
condition = Expression(
"attribute_not_exists(#idontexist) OR #idontexist = :dummy",
Map("#idontexist" -> "idontexist"),
Map(":dummy" -> "dummy".asAttributeValue)
)
This will result in the following error:
If I understand correctly you shouldn't set the
expressionAttributeValuesto an empty collection, but rather not set it at all in that case. I guess that probably the same issue can occur forexpressionAttributeNames.Essentially it's a bug in the aws SDK imho.
A workaround I found for now is adding a
conditionthat should always be true, because the names and values will be merged with those of theupdate: