Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Harness deploy fails: CLI-generated API-key credential provider names use underscores, which ApiKeyArn rejects

Aperta Adatta ai principianti
#2,546 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
cli

Direzione di ricerca

Inizia da providerName() in src/core/project/backends/cdk/credentials.ts:44 e traccia dove quel nome viene assemblato nell'ApiKeyArn emesso per AWS::BedrockAgentCore::Harness, oltre a come agentcore status e deploy lo rileggono. Definisci prima la direzione della correzione con il maintainer (cambiare il separatore vs. sanitizerizzare solo il segmento ARN), dato che rinominare influenza i provider già deployati. Concluso quando la repro dell'issue — aggiungere le credenziali, poi aggiungere un harness che referenzia l'ARN riportato — supera la validazione precoce di deploy e i nomi dei provider esistenti continuano a risolversi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug
What happens

A harness that uses an API-key model provider (OpenAI or Gemini) cannot be deployed when its apiKeyArn points at a credential provider the CLI created. The deploy fails CloudFormation's early validation:

Error: ❌  AgentCore-<project>-default failed: DeploymentError: Early validation failed for change set cdk-deploy-change-set:
AgentCore-<project>-default/Application/HarnessGeminiHarness/Harness/Resource  (AWS::BedrockAgentCore::Harness ...)
  Property value
  [arn:aws:bedrock-agentcore:us-east-1:<account>:token-vault/default/apikeycredentialprovider/<project>_default_GeminiKey]
  does not match pattern:
  ^arn:aws(-[^:]+)?:bedrock-agentcore:[a-z0-9-]+:[0-9]{12}:token-vault/[a-zA-Z0-9-.]+/apikeycredentialprovider/[a-zA-Z0-9-.]+$
  (at /Resources/.../Properties/Model/GeminiModelConfig/ApiKeyArn)
Why

providerName() in src/core/project/backends/cdk/credentials.ts:44 builds the Identity provider name as:

return `${projectName}_${targetName}_${credentialName}`;

CreateApiKeyCredentialProvider accepts those underscores, so the provider is created fine and agentcore status reports it as deployed. But the ApiKeyArn property on AWS::BedrockAgentCore::Harness only allows [a-zA-Z0-9-.]+ in the provider segment, so the same ARN is rejected when a harness references it. The two sides disagree on the allowed character set.

Impact

Any open_ai or gemini harness wired to a CLI-managed credential fails to deploy. The failure comes at deploy time, after the credential provider has already been created in the account.

Reproduce
agentcore create --name repro
cd repro
agentcore add credentials api-key --name GeminiKey --api-key file://./key.txt
agentcore deploy          # creates the provider: repro_default_GeminiKey
agentcore add harness --name GeminiHarness \
  --model '{"provider":"gemini","modelId":"gemini-3.8-flash","apiKeyArn":"<the ARN from agentcore status>"}'
agentcore deploy          # fails early validation on ApiKeyArn

Confirmed it's the underscores: creating a provider named dashtest-geminikey by hand and pointing the same harness at that ARN deploys successfully.

Possible fixes
  • Use a separator the harness pattern accepts (e.g. -) in providerName(). This renames providers, so it needs a migration path for projects that already deployed.
  • Or sanitize only what goes into the ARN, and keep the existing name for providers already out there.
  • Either way, validating the ARN shape in the CLI before deploy would turn this into an upfront error instead of a CloudFormation failure.
Environment
  • CLI built from refactor (v1.0.0-rc.5 line)
  • Region us-east-1, commercial partition
Lingua principale
TypeScript
Stelle
304
Fork
105
Merge medio
17h 33m
PR unite (30g)
192

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di aws/agentcore-cli

Tutte le issue di aws/agentcore-cli

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.