Error: dynamodb can not resolve withkeyconditionexpression
Answered by Rafal Wilinski
What's Causing This Error
This error may occur when you provide an invalid DynamoDB query param in the DocumentClient
of Node.js AWS SDK. For example, the Node.js DocumentClient
uses the KeyConditionExpression
and not withKeyConditionExpression
(unlike Java), and therefore, you may run into this error when you incorrectly provide the Key Condition Parameter.
Solution: Here's How To Resolve It
To resolve the error, use KeyConditionExpression
in the Query Params, as shown below.
const docClient = new AWS.DynamoDB.DocumentClient({apiVersion: '2012-08-10'}); const params = { ExpressionAttributeValues: { ':s': 2, ':e': 9, ':topic': 'PHRASE' }, KeyConditionExpression: 'Season = :s and Episode > :e', FilterExpression: 'contains (Subtitle, :topic)', TableName: 'EPISODES_TABLE' }; docClient.query(params, function(err, data) { if (err) { console.log("Error", err); } else { console.log("Success", data.Items); } });
Other Common DynamoDB Errors (with Solutions)
- DynamoDB No Provisioned Throughput specified for the table
- dynamodb throttle error code
- dynamodb atomic counter not working
- dynamodb: one or more parameter values were invalid: type mismatch for index key
- AWS DynamoDB CredentialsError: Missing credentials in config
- aws.dynamodb.documentclient is not a constructor
- dynamodb ttl not deleting / erasing items
- dynamodb connection timeout
- comparison operator does not return all attributes dynamodb
- appsync dynamodb not seeing all fields
- boto3 dynamodb unable to locate credentials
- dynamodb does not support null values
- an expression attribute name used in the document path is not defined
- aws.dynamodb.converter.unmarshall not working
- failed to list tables not authorized dynamodb
Tired of switching accounts and regions? Use Dynobase.
First 7 days are on us. No strings attached.
Product Features
DynamoDB Tools
DynamoDB Info
© 2024 Dynobase