datastore-s3 throws the wrong error when a file isn't found on s3
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- aws, typescript
调研方向
从 issue 中链接的 404 状态检查处开始查看 packages/datastore-s3/src/index.ts,并将其错误处理与 packages/datastore-fs/src/index.ts 进行比较。通过 helia.pins.add 或 helia.pins.ls 入口确认该行为;缺失的 S3 文件应产生 NotFoundError,而不是 GetFailedError。
由索引模型根据 Issue 内容生成。
描述
When using datastore-s3, calling helia.pins.add or helia.pins.ls fails with a "NoSuchKey" error
err: {
"type": "GetFailedError",
"message": "NoSuchKey: The specified key does not exist.",
If a file isn't found a "NotFoundError" is gracefully handled, but a GetFailedError throws. datastore-s3's "get" method currently throws a GetFailedError when a given file isn't found.
This is because the 404 status check doesn't line up with the response from s3 (this line)
Applied the following patch to fix:
diff --git a/dist/src/index.js b/dist/src/index.js
index 3dc550c3fa0abaf3c6c1fe7bb7ca4107c824ba3d..88f43d0939f9dbc754097723c0bcab15fdacae88 100644
--- a/dist/src/index.js
+++ b/dist/src/index.js
@@ -113,7 +113,7 @@ export class S3Datastore extends BaseDatastore {
return await toBuffer(data.Body);
}
catch (err) {
- if (err.statusCode === 404) {
+ if (err.statusCode === 404 || err.$metadata.httpStatusCode === 404 || String(err).includes('NoSuchKey')) {
throw new NotFoundError(String(err));
}
throw new GetFailedError(String(err));
- 主要语言
- TypeScript
- 星标
- 39
- 派生
- 28
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ipfs/js-stores 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 85/100
-
need/triage
难度 5/5 一周以上 新手友好度 25/100
-
feat: create new core data & blockstore that acts as a cache/buffered store可能重新可做 @SgtPooki 于 1046 天前认领,目前没有进行中的 PR。 未关闭dif/medium effort/days kind/enhancement P1 status/in-progress
-
need/triage
难度 1/5 1 小时以内 新手友好度 45/100
-
datastore-idb .query doesn't work as expected可能重新可做 关联的 PR 已关闭且未合并。 未关闭kind/bug
难度 4/5 3-5 天 新手友好度 25/100
相似的 Issue
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2
难度 2/5 1-3 小时 新手友好度 68/100
openclaw/openclaw#199885 · 2 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
-
feature needs-triage
难度 2/5 1-3 小时 新手友好度 78/100
BoardGamesEmpire/board-games-empire-backend#1306 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 80/100
sequant-io/sequant#1689 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 80/100