project build: skip STS GetCallerIdentity when every deployment target already has an account
メンテナーはふだん 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 の本文から書いたものです。
説明
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_PROFILEcurrently causes the pinnedConfigIO.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 sixGetCallerIdentityattempts 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 insrc/assets/cdk/package.json(currently0.1.0-alpha.45), whichscripts/sync-template-cdk.mjsandsrc/assets/__tests__/cdk-schema-compat.test.tscover. - 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 inaws-targets.jsonwith explicitaccountvalues, blackholests.*.amazonaws.com, then runagentcore project build.
cc @notgitika
- 主要言語
- TypeScript
- スター
- 291
- フォーク
- 96
- 平均マージ
- 20時間 50分
- マージ済み PR(30日)
- 214
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
aws/agentcore-cli のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
aws/agentcore-cli#2395 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
aws/agentcore-cli#2392 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
aws/agentcore-cli#2267 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
aws/agentcore-cli#2258 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
aws/agentcore-cli#2176 ·
メンテナーはふだん 1 日以内に返信
aws/agentcore-cli の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
opengovsg/FormSG#10118 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
ai-driven-qa bug claude
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
linagora/twake-calendar-frontend#1434 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
check:passed streams:add
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
iptv-org/iptv#52824 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 78/100
jaegertracing/jaeger-ui#4512 ·
メンテナーはふだん 1 日以内に返信
-
area:ide documentation enhancement platform:macos platform:vscode
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
anthropics/claude-code#97389 ·
メンテナーはふだん 1 日以内に返信