@aws-sdk/create-repro
v1.0.0
Published
Create Minimal Reproduction for AWS SDKs
Downloads
48
Readme
Create minimal reproduction for AWS SDKs
@aws-sdk/create-repro is a CLI tool that generates ready-to-run project environments for AWS SDK for JavaScript v3. It supports Node.js, Browser (Vite + Amazon Cognito), and React Native environments across AWS services with autocomplete, operation validation, and typo detection.
Prerequisites
- Node.js
- AWS credentials configured on your machine (for Node.js projects)
Usage
npm create @aws-sdk/reproAfter running npm start in the generated project, you should see the API response printed to the console. If you see a credentials error, verify your AWS credentials are configured correctly by running aws sts get-caller-identity.
Note: Running the generated projects makes API calls to AWS services, which may incur charges based on standard AWS pricing. Review pricing for the services you use and clean up resources when finished.
Interactive Prompts
The CLI guides you through the following steps:
AWS SDK Reproduction Project Generator
? Select JavaScript environment: (Node.js / Browser / React Native)
? Enter project name: aws-sdk-repro-a1b2c3d4
? Select or search for AWS service: (autocomplete)
Fetching available operations for S3...
Found 128 operations
? Select or search for operation (kebab-case): list-buckets
? Select or enter AWS region: us-east-1 - US East (N. Virginia)
Successfully created JS project at:
/path/to/aws-sdk-repro-a1b2c3d4
To get started:
cd aws-sdk-repro-a1b2c3d4
npm install
npm startEnvironments
Node.js
Generates a project using the default AWS credential chain. Run with npm start.
Browser
Generates a Vite-based project with Amazon Cognito identity pool for browser-safe credentials. A COGNITO_SETUP.md guide is included with setup instructions. Run with npm start (opens browser via Vite dev server).
React Native
Generates a full React Native project via @react-native-community/cli (pinned to RN 0.76.6 for Xcode 15 compatibility). Includes required polyfills (compatibility libraries that provide missing platform features: react-native-get-random-values, react-native-url-polyfill, web-streams-polyfill) and Amazon Cognito authentication.
Features
- Service autocomplete: Search across
@aws-sdk/client-*packages with fuzzy matching (flexible search that finds close matches) - Typo detection: Uses Levenshtein distance, a measure of character differences (max 2 edits), to suggest corrections for mistyped services and regions
- Dynamic operation discovery: Temporarily installs the selected SDK package to discover available operations and extract the correct client name (such as
DynamoDBClientnotDynamodbClient) - Region validation: AWS regions with display names, format validation, and underscore-to-hyphen correction
- Kebab-case input: Operations entered in kebab-case format (lowercase with hyphens, such as
list-buckets) are automatically converted toListBucketsCommand
Development
# Clone the repository
git clone https://github.com/awslabs/create-aws-sdk-repro.git
cd create-aws-sdk-repro
npm install
# Run the CLI
node src/cli.js
# Navigate to the generated project
cd <your-project-name>
npm install
npm startFor Node.js projects, ensure your AWS credentials are configured (aws configure or environment variables). For Browser and React Native projects, follow the generated COGNITO_SETUP.md to configure an Identity Pool before running.
Quick smoke test
# Generate a Node.js project for S3 ListBuckets
node src/cli.js
# Select: Node.js → any project name → @aws-sdk/client-s3 → list-buckets → us-east-1
# Verify the generated project runs
cd <project-name>
npm install
npm startOperations like ListBuckets, DescribeInstances, and ListTables work with an empty input object, so the generated project runs out of the box. For operations that require parameters, modify the input object in the generated index.js:
const input = {
// Add your input parameters here
// IDE autocomplete will show available fields since types are already imported
};Cleanup
The generated projects are standalone directories on your local machine. To clean up, delete the project directory.
If you created an Amazon Cognito identity pool for Browser or React Native testing, delete the Identity Pool and any associated IAM roles that are no longer needed.
If your generated project created AWS resources (such as S3 buckets or DynamoDB tables), delete those resources through the AWS Management Console or AWS CLI to avoid ongoing charges. Ensure you have backups of any data you want to retain before deletion.
Security
See CONTRIBUTING for more information.
License
This project is licensed under the Apache-2.0 License.
