Skip to content

UpdateItemAsync - DynamoDB Exception: ExpressionAttributeValues must not be empty, even when there are no variables #4144

@elias-visma

Description

@elias-visma

Describe the bug

This bug is similar to #3802 (could not use conditional expressions without supplying ExpressionAttributeValues in PutItemAsync()) which has been fixed (#3804) but the issue remains for UpdateItemAsync(). This worked in V3 of the SDK (AWSSDK.DynamoDBv2 3.7.404.11)

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

The operation should succeed as it did with V3 of the SDK.

Current Behavior

The operation throws the following exception:
AmazonDynamoDBException: ExpressionAttributeValues must not be empty
The behavior is the same, even if ExpressionAttributeValues is explicitly set to null or an empty collection.

Reproduction Steps

await table.UpdateItemAsync(document, new UpdateItemOperationConfig
{
    ConditionalExpression = new Expression { ExpressionStatement = "attribute_not_exists(pk)" }
};

Possible Solution

Two workarounds:
Setting
Amazon.AWSConfigs.InitializeCollections = true;
or
including unnecessary values in ExpressionStatement and ExpressionAttributeValues.

The solution for PutItemAsync() was solved in (#3804)

Additional Information/Context

No response

AWS .NET SDK and/or Package version used

AWSSDK.DynamoDBv2 4.0.6.4

Targeted .NET Platform

.Net 8

Operating System and version

Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.dynamodbp1This is a high priority issuepotential-regressionMarking this issue as a potential regression to be checked by team memberpr/blockedThis PR cannot be merged or reviewed, because it is blocked for some reason.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions