Skip to content
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

Dynamodb missing error with ADD empty set #7595

Open
jasonrdunne opened this issue Apr 14, 2024 · 2 comments
Open

Dynamodb missing error with ADD empty set #7595

jasonrdunne opened this issue Apr 14, 2024 · 2 comments

Comments

@jasonrdunne
Copy link

This error is caught by aws, but not with moto:

ExpressionAttributeValues contains invalid value: One or more parameter values were invalid: An number set may not be empty for key :deletedConversationIds

It's caused by an update like this:

        user_table.update_item(
            TableName="Users",
            Key={"userId": user_id},
            UpdateExpression="ADD stringSet :emptySet",
            ExpressionAttributeValues={
                ":emptySet": empty_set,
            },
        )
@jasonrdunne
Copy link
Author

I found another similar issue:

if an ExpressionAttributeValue is defined and not used, it errors in real aws, but not moto:

Value provided in ExpressionAttributeValues unused in expressions: keys: {:variable}

@bblommers
Copy link
Collaborator

Hi @jasonrdunne, thanks for raising these! I'll open a PR to add validation for the first issue in a second.

Do you have an example for the second issue? The following code does throw an error in Moto:

dynamodb.update_item(
            TableName=table_name,
            Key={"pk": {"S": "foo"}},
            UpdateExpression="ADD stringset :emptySet",
            ExpressionAttributeValues={":emptySet": {"SS": ()}, "other": {"S": "data"}},
        )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants