Dynamodb KeyConditionExpression use gives ValidationException #4345
-
Confirm by changing [ ] to [x] below to ensure that it's a bug:
Describe the bug Version of AWS SDK for Go? Version of Go ( To Reproduce (observed behavior)
Then following the instructions here: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.KeyConditions.html I wrote the following which at runtime throws a validationException.
Expected behavior Additional context |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I was getting a similar ValidationException with Here's what worked for me: cond, err := expression.NewBuilder().
WithKeyCondition(expression.Key("bucket").Equal(expression.Value(bucket))).
Build()
// handle error
q := dynamodb.QueryInput{
TableName: aws.String("my-buckets-table"),
// TODO this line is problematic, since we get the error:
// failed to query data: ValidationException: The table does not have the specified index: bucket
//IndexName: aws.String("bucket"),
KeyConditionExpression: cond.KeyCondition(),
ExpressionAttributeNames: cond.Names(),
ExpressionAttributeValues: cond.Values(),
Limit: aws.Int64(1),
} |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
I was getting a similar ValidationException with
expression.NewBuilder
. Ultimately, what was causing the error on my end was using theQueryInput.IndexName
field (not sure why).Here's what worked for me: