Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
UserTable
✓ import { UserTable } from 'cmp-aws-database'
✗ const UserTable = require('cmp-aws-database').UserTable
Package is ESM-only; require() will fail. Use named import.
RecipeTable
✓ import { RecipeTable } from 'cmp-aws-database'
✗ import RecipeTable from 'cmp-aws-database'
RecipeTable is a named export, not default. Do not use default import.
getDatabaseClient
✓ import { getDatabaseClient } from 'cmp-aws-database'
Function to obtain a configured DynamoDB client.
Initializes the database client and creates a user item in the UserTable.
import { UserTable, RecipeTable, getDatabaseClient } from 'cmp-aws-database';
const client = getDatabaseClient({
region: 'us-east-1',
accessKeyId: process.env.AWS_ACCESS_KEY_ID ?? '',
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY ?? ''
});
async function createUser(userId: string, name: string) {
const params = {
TableName: UserTable.name,
Item: { userId, name, createdAt: new Date().toISOString() }
};
await client.put(params).promise();
console.log('User created');
}
createUser('123', 'Alice').catch(console.error);
Errors
Common errors & fixes
Cannot find module 'cmp-aws-database' or its corresponding type declarations.
The package is not installed or TypeScript cannot locate its types.
fixRun 'npm install cmp-aws-database' and ensure tsconfig.json includes 'moduleResolution': 'node'.
TypeError: UserTable.name is undefined
Importing incorrectly (e.g., using default import instead of named import).
fixUse 'import { UserTable } from 'cmp-aws-database''. ValidationError: "name" is required
Missing required field when putting item into a table with Zod validation.
fixEnsure all required fields per the Zod schema are provided in the item object.
Region is missing
getDatabaseClient() called without region option.
fixProvide region in the config object to getDatabaseClient().
Audit
Dependencies
aws-sdkrequiredRequired for AWS DynamoDB client and table operations.
zodoptionalUsed for schema validation of table items.