Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
abc-rpg opened this issue May 8, 2025 · 3 comments · Fixed by #3804
Closed
1 task done
Labels
bug This issue is a bug. dynamodb p1 This is a high priority issue potential-regression Marking this issue as a potential regression to be checked by team member

Comments

@abc-rpg
Copy link

abc-rpg commented May 8, 2025

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

@abc-rpg abc-rpg added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 8, 2025
@github-actions github-actions bot added the potential-regression Marking this issue as a potential regression to be checked by team member label May 8, 2025
@abc-rpg abc-rpg changed the title DynamoDB Exception: ExpressionAttributeValues must not be empty even when there are no variables DynamoDB Exception: ExpressionAttributeValues must not be empty, even when there are no variables May 8, 2025
@dscpinheiro dscpinheiro added dynamodb p1 This is a high priority issue and removed needs-triage This issue or PR still needs to be triaged. labels May 8, 2025
@normj
Copy link
Member

normj commented May 8, 2025

Thanks for reporting the issue. We'll take a look into the issue.

@abc-rpg
Copy link
Author

abc-rpg commented May 13, 2025

Thank you! I verified the fix in 4.0.0.4.

I am however running into a new issue now, and I think still related to uninitialized collections. I'll be creating a new issue for that, and close this one since this is solved.

@abc-rpg abc-rpg closed this as completed May 13, 2025
Copy link

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. dynamodb p1 This is a high priority issue potential-regression Marking this issue as a potential regression to be checked by team member
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants