Error: aws.dynamodb.documentclient is not a constructor
What's Causing This Error
This error occurs in Node.js when you install an older version of the AWS SDK. AWS introduced the DocumentClient in version 2.2.0 of the AWS SDK. So all applications running a version number lower than 2.2.0 of the AWS SDK will experience this error as the DocumentClient does not exist in these earlier versions.
Solution - Here's How To Resolve It
To resolve the error, install the latest version of the AWS SDK using the below command.
npm i aws-sdk@latest
If the above command does not work, delete the
package-lock.json file and re-rerun the command.
Other Common DynamoDB Errors (with Solutions)
- DynamoDB Internal Server Error
- ValidationException: Invalid KeyConditionExpression: Attribute name is a reserved keyword;
- could not unconvert attribute dynamodb
- DynamoDB Key element does not match the schema
- dynamodb put function not working
- aws lambda dynamodb nodejs not working after few puts
- sls dynamodb install not working
- One or more parameter values were invalid: some AttributeDefinitions are not used
- an expression attribute name used in the document path is not defined
- Float types are not supported. Use decimal types instead.
- is not authorized to perform dynamodb:* on resource
- dynamodb put item not working
- dynamodb: one or more parameter values were invalid: type mismatch for index key
- AWS DynamoDB CredentialsError: Missing credentials in config
- ImportError: No module named boto3 (DynamoDB)
© 2022 Dynobase