invoke: CUSTOM_JWT runtime errors discard the response body and error type (e.g. "Token has expired")
維護者通常 1 天內回覆
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 82/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- node.js, typescript
- 領域
- cli
研究方向
從 src/core/invokeRuntime.ts 開始,在 !response.ok 分支中(invokeRuntimeWithCustomJwt 的,大約第 170-178 行),這裡 body 會被取消,只有 status/headers 會保留。在取消之前用有界讀取讀取 body,對 JSON-RPC body 解析 error.message,對一般 JSON 解析 message,當為空或無法解析時回退到現有的 status 行;還要檢查 --json 輸出路徑,以便兩個欄位都包含在內。當針對真實 runtime 的被拒絕 invocation 將錯誤類型與訊息列印到 stderr,且相同欄位出現在 --json 中時,即完成。
由索引模型根據 Issue 內容生成。
描述
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.
- 主要語言
- TypeScript
- 星號
- 339
- 分支
- 129
- 平均合併
- 19 小時 21 分鐘
- 30 天內合併 PR
- 125
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
aws/agentcore-cli 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 88/100
aws/agentcore-cli#2940 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
aws/agentcore-cli#2939 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 84/100
aws/agentcore-cli#2938 ·
維護者通常 1 天內回覆
-
--debug has no effect; service error name, HTTP status and request ID never reach the terminal可能已有人在做 @abhiramshaji-cyber 於 3 天前認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 78/100
aws/agentcore-cli#2874 ·
維護者通常 1 天內回覆
-
`agentcore dev` container fails with LoginTokenLoadError when using `aws login` credentials可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉bug
難度 2/5 1-3 小時 新手友好度 80/100
aws/agentcore-cli#2606 · 4 則留言 ·
維護者通常 1 天內回覆
查看 aws/agentcore-cli 的全部 Issue
相似的 Issue
-
bot:ai-assisted component:faucet status:untriaged
難度 2/5 1-3 小時 新手友好度 78/100
midnightntwrk/midnight-faucet-api#222 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
bluesky-social/social-app#12545 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 67/100
knaw-huc/textannoviz#742 ·
-
難度 2/5 1-3 小時 新手友好度 88/100
cloudflare/realtimekit-ui#219 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
cdklabs/cdk-nextjs#365 ·
維護者通常 1 天內回覆