Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

project build: skip STS GetCallerIdentity when every deployment target already has an account

オープン
#1,993 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
aws, typescript
領域
build-system, cli

調査の方向性

construct ライブラリの lib/schemas/io/config-io.ts から始め、aws-targets.json に明示的なアカウントを指定して AWS_PROFILE のケースを再現します。同じメソッド内の resolveRegionFallback() を確認し、続いて src/assets/cdk/package.json の pin を確認して、scripts/sync-template-cdk.mjs と src/assets/tests/cdk-schema-compat.test.ts を実行します。完全に入力された targets がビルド中に STS をトリガーしなければ完了です。

索引モデルが issue の本文から書いたものです。

説明

bug P3

agentcore project build is meant to be fully offline: it runs cdk synth only, and every stack's environment comes from agentcore/aws-targets.json. It currently isn't, when AWS_PROFILE is set.

Found by @aidandaly24 in review of #1970 (comment):

Non-blocking and fine as a follow-up: synthesis succeeds without credentials, but AWS_PROFILE currently causes the pinned ConfigIO.readAWSDeploymentTargets() to call STS even when every target already has an account. I confirmed this by redirecting STS locally. The build still succeeded, but made six GetCallerIdentity attempts and inherited the retry latency. Could we avoid that fallback when account values are already present so build is fully offline?

Cause

In @aws/[email protected], lib/schemas/io/config-io.ts:

// Only resolve account for targets that don't already have one saved
if (process.env.AWS_PROFILE) {
  const account = await detectAwsAccount();   // <-- STS GetCallerIdentity
  if (account) {
    targets = targets.map(t => (t.account ? t : { ...t, account }));
  }
}

The t.account ? t : ... guard is applied to the result. The STS call itself is gated only on AWS_PROFILE being set, so it fires even when it cannot change anything. detectAwsAccount() swallows failures, which is why the build still succeeds — but the SDK's default retry policy is paid first (the six attempts Aidan measured).

Suggested fix

Hoist the guard so the call is skipped when it would be a no-op:

if (process.env.AWS_PROFILE && targets.some(t => !t.account)) {
  ...
}

Worth reviewing resolveRegionFallback() in the same method too — it reads shared config files rather than calling a service, so it's cheap, but it runs unconditionally for the same reason.

Notes

  • The fix lives in the construct library (@aws/agentcore-cdk), not this CLI. Landing it here is then a version bump of the exact pin in src/assets/cdk/package.json (currently 0.1.0-alpha.45), which scripts/sync-template-cdk.mjs and src/assets/__tests__/cdk-schema-compat.test.ts cover.
  • No CLI-side workaround is needed in the meantime: build still succeeds, it's latency plus an unnecessary credential dependency.
  • Repro: set AWS_PROFILE, fill in aws-targets.json with explicit account values, blackhole sts.*.amazonaws.com, then run agentcore project build.

cc @notgitika

主要言語
TypeScript
スター
291
フォーク
96
平均マージ
20時間 50分
マージ済み PR(30日)
214

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

aws/agentcore-cli のほかの issue

aws/agentcore-cli の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。