Skip to content

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

Closed
@abc-rpg

Description

@abc-rpg

Describe the bug

With version 4 of the SDK and using the Document Model, PutItemAsync operations fail when passing a PutItemOperationConfig without any ExpressionAttributeValues, even if the ConditionalExpression has no variables.

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.PutItemAsync(document, new PutItemOperationConfig
{
    ConditionalExpression = new Expression { ExpressionStatement = "attribute_not_exists(pk)" }
};

Possible Solution

Setting the InitializeCollections to true fixes the issue.

Amazon.AWSConfigs.InitializeCollections = true;

However this is not the desired solution.

Additional Information/Context

Stack Trace:

at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleExceptionStream(IRequestContext requestContext, IWebResponseData httpErrorResponse, HttpErrorResponseException exception, Stream responseStream)
at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleExceptionAsync(IExecutionContext executionContext, HttpErrorResponseException exception)
at Amazon.Runtime.Internal.ExceptionHandler`1.HandleAsync(IExecutionContext executionContext, Exception exception)
at Amazon.Runtime.Internal.ErrorHandler.ProcessExceptionAsync(IExecutionContext executionContext, Exception exception)
at Amazon.Runtime.Internal.ErrorHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.Signer.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.BaseAuthResolverHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.MetricsHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.DynamoDBv2.DocumentModel.Table.PutItemHelperAsync(Document doc, PutItemOperationConfig config, CancellationToken cancellationToken)
at Amazon.DynamoDBv2.DocumentModel.Table.PutItemAsync(Document doc, PutItemOperationConfig config, CancellationToken cancellationToken)

AWS .NET SDK and/or Package version used

AWSSDK.DynamoDBv2 4.0.0.3

Targeted .NET Platform

.NET 9

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 member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions