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 天内回复