invoke: CUSTOM_JWT runtime errors discard the response body and error type (e.g. "Token has expired")
I maintainer di solito rispondono entro 1 giorno
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
- node.js, typescript
- Ambito
- cli
Direzione di ricerca
Inizia in src/core/invokeRuntime.ts, nel ramo !response.ok di invokeRuntimeWithCustomJwt (intorno alle righe 170-178), dove il body viene annullato e sopravvivono solo status/headers. Leggi il body con una lettura limitata prima di annullare, esegui il parse di error.message per i body JSON-RPC e di message per JSON semplice, e ricadi sulla riga di stato esistente quando è vuoto o non analizzabile; controlla anche il percorso di output --json in modo che entrambi i campi siano inclusi. Fatto quando un'invocazione rifiutata contro un runtime reale stampa il tipo di errore e il messaggio su stderr e gli stessi campi compaiono in --json.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
When a CUSTOM_JWT Runtime invocation returns a non-2xx response, the CLI discards the response body and the x-amzn-errortype header, so the reason for the failure never reaches the user.
In src/core/invokeRuntime.ts (invokeRuntimeWithCustomJwt), the !response.ok branch reads the request ID, then calls response.body?.cancel() and returns only status and header metadata.
Since #2751 (1.0.2) a status line is printed to stderr. Before that (1.0.1) nothing was printed at all.
Steps to Reproduce
- Have a Runtime with a CUSTOM_JWT authorizer.
- Invoke it with an expired token:
agentcore invoke --runtime <name> --bearer-token "$EXPIRED_TOKEN" --payload '{"prompt":"hi"}'
Expected Behavior
stderr includes the error type and the message from the response body, for example:
Error: HTTP 401 UnrecognizedClientException: Token has expired (request-id=<id>)
Actual Behavior
1.0.2+ prints only:
status=401 content-type=... complete=false bytes=0 error=HTTP 401 request-id=<id>
1.0.1 prints nothing and exits 1.
For comparison, the same request with curl returns header x-amzn-errortype: UnrecognizedClientException:<namespace> and body {"jsonrpc":"2.0","error":{"code":-32001,"message":"Token has expired"}}.
CLI Version
1.1.0 (also 1.0.1)
Operating System
Linux
Additional Context
Acceptance:
- On a rejected CUSTOM_JWT invocation, read (a bounded amount of) the body and surface the error type and message.
- Handle both JSON-RPC (
error.message) and plain JSON (message) bodies; fall back to the current status line when the body is empty or unparseable. -
--jsonoutput carries the same fields.
- Lingua principale
- TypeScript
- Stelle
- 339
- Fork
- 129
- Merge medio
- 19h 21m
- PR unite (30g)
- 125
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di aws/agentcore-cli
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
aws/agentcore-cli#2940 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
aws/agentcore-cli#2939 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
aws/agentcore-cli#2938 ·
I maintainer di solito rispondono entro 1 giorno
-
--debug has no effect; service error name, HTTP status and request ID never reach the terminalForse già presa @abhiramshaji-cyber l’ha presa 3 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
aws/agentcore-cli#2874 ·
I maintainer di solito rispondono entro 1 giorno
-
`agentcore dev` container fails with LoginTokenLoadError when using `aws login` credentialsForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
aws/agentcore-cli#2606 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di aws/agentcore-cli
Issue simili
-
bot:ai-assisted component:faucet status:untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
midnightntwrk/midnight-faucet-api#222 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
bluesky-social/social-app#12545 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
knaw-huc/textannoviz#742 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
cloudflare/realtimekit-ui#219 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
cdklabs/cdk-nextjs#365 ·
I maintainer di solito rispondono entro 1 giorno