Skip to content

Decouple common-aws from environment and add subpath exports#26

Merged
devshorts merged 7 commits intomainfrom
akropp/aws-env
Mar 26, 2026
Merged

Decouple common-aws from environment and add subpath exports#26
devshorts merged 7 commits intomainfrom
akropp/aws-env

Conversation

@devshorts
Copy link
Copy Markdown
Contributor

@devshorts devshorts commented Mar 26, 2026

Consumers of common-aws were forced to install every dependency (common-server, aws-lambda, datadog-lambda-js, all AWS SDK clients) even when they only needed a single module like PartitionedKeyValueTable. This PR breaks that coupling so each subpath carries only the deps it actually uses.

Summary

  • Add exports field with 12 subpath entries (./dynamo/keys, ./sqs, ./s3, etc.) so consumers import only what they need
  • Move AWS SDK clients, common-server, aws-lambda, and datadog-lambda-js from direct dependencies to optional peer dependencies (with dev dependencies for local build/test)
  • Bump AWS SDK peer deps from ^3.835.0 to ^3.1002.0
  • Remove dynamoTableName() and assertTableNameValid() — table names are now required, not derived from the runtime environment
  • Decouple SQS consumer from implicit PartitionedKeyValueTable and environment checks; accept proxyProvider via opts
  • Extract DynamoUtil class from DynamoDocker with createTable and removeTable so table management isn't tied to Docker
  • Pass dummy credentials to DynamoDB Docker client so the SDK doesn't try SSO/instance metadata for local containers
  • Move md5/consistentMd5 from common-server to common (re-exported from common-server for compat)
  • Create sns/index.ts barrel for subpath export consistency
  • Remove trivial DynamoTableName type-cast test
  • Bump all workspace packages to 3.0.0

Usage

// Before: pulls in everything
import { PartitionedKeyValueTable } from '@paradoxical-io/common-aws';

// After: only needs @aws-sdk/client-dynamodb
import { PartitionedKeyValueTable } from '@paradoxical-io/common-aws/dynamo/keys';

Relevant Gif

vibe

These hash utilities have no server-side dependencies beyond crypto,
so they belong in the lightweight common package. Allow crypto in
common eslint config. Re-exports from common-server for backwards
compatibility.
Make tableName required instead of deriving it from the environment at
runtime. Remove dynamoTableName() and assertTableNameValid() helpers
that coupled the library to a specific naming convention. Decouple SQS
consumer from implicit PartitionedKeyValueTable and environment checks
by accepting proxyProvider via opts.
Move createTable logic into a standalone DynamoUtil class so table
management is not tied to the Docker test helper. Add removeTable for
cleanup. DynamoDocker delegates to DynamoUtil for backwards compat.
Add exports field with 12 subpath entries so consumers can import only
the modules they need without pulling in the full dependency tree.
Move AWS SDK, common-server, aws-lambda, and datadog-lambda-js to
optional peerDependencies (with devDependencies for local build/test).
Bump AWS SDK peer deps to ^3.1002.0. Create sns/index.ts barrel for
consistency. Version bump to 3.0.0 (breaking: peer dep migration).
Update common-aws README with subpath export table and per-module peer
dependency requirements. Bump all workspace packages to 3.0.0 for the
breaking change.
Prevents the SDK from walking the default credential provider chain
(which tries SSO, instance metadata, etc.) when connecting to a local
DynamoDB container that doesn't check credentials.
@devshorts devshorts enabled auto-merge (squash) March 26, 2026 18:12
@devshorts devshorts merged commit b31e55d into main Mar 26, 2026
1 check passed
@devshorts devshorts deleted the akropp/aws-env branch March 26, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant