Skip to content

fix: add missing AWS SDK dependencies to TypeScript agent package.json - #2010

Open
jyotsnamas wants to merge 1 commit into
awslabs:mainfrom
jyotsnamas:fix/typescript-missing-aws-sdk-deps
Open

fix: add missing AWS SDK dependencies to TypeScript agent package.json#2010
jyotsnamas wants to merge 1 commit into
awslabs:mainfrom
jyotsnamas:fix/typescript-missing-aws-sdk-deps

Conversation

@jyotsnamas

Copy link
Copy Markdown
Contributor

Summary

  • Add @aws-sdk/client-bedrock-runtime and @aws-sdk/client-s3 to package.json dependencies
  • @strands-agents/sdk requires these as peer dependencies but they weren't listed, so npm install && npm run build fails out of the box

Root cause

esbuild bundles all imports (no --external flag in the build script). Without these packages installed, the build fails:

✘ [ERROR] Could not resolve "@aws-sdk/client-s3"

If you work around the build by adding --external:@aws-sdk/*, the deployed runtime crashes at startup:

Error: Cannot find module '@aws-sdk/client-bedrock-runtime'

Verification

Deployed to AgentCore Runtime (NODE_22) in us-west-2:

  • Without fix: build fails, or runtime crashes with Cannot find module
  • With fix: npm install && npm run build succeeds, agent responds correctly
$ bash runtime.sh invoke <arn> "What is 25 * 17 + 42?"
→ "The answer is **467**."

$ bash runtime.sh invoke <arn> "Divide 100 by 7"
→ "100 divided by 7 equals approximately **14.29**"

Test plan

  • npm install && npm run build succeeds without manual intervention
  • Deploy to AgentCore Runtime → status READY
  • Invoke with calculator prompts → correct answers
  • Cleanup → runtime deleted

🤖 Generated with Claude Code

@strands-agents/sdk requires @aws-sdk/client-bedrock-runtime and
@aws-sdk/client-s3 as peer dependencies, but they weren't listed in
package.json. This causes `npm install && npm run build` to fail
because esbuild cannot resolve the imports during bundling.

Without this fix, the deployed runtime also crashes at startup with
"Cannot find module '@aws-sdk/client-bedrock-runtime'" if the bundle
is built with --external:@aws-sdk/*.

Verified by deploying to AgentCore Runtime (NODE_22) in us-west-2:
- Without fix: build fails or runtime crashes with ModuleNotFoundError
- With fix: agent responds correctly to calculator prompts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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