bug: an object-store 404 with an empty reason phrase makes a missing transcript a 502 instead of a 404

未關閉
#4,984 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
25/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
停滯
技術堆疊
typescript
領域
backend

研究方向

從 apps/webapp/app/v3/objectStoreClient.server.ts:135-141 開始,這裡 getObjectResponse 拋出錯誤時只使用 response.statusText;以及 apps/webjapp/app/services/realtime/transcriptDownload.server.ts:46-54 的 isTranscriptNotFound,它以固定的 "Not Found" 正規表示式比對訊息。將 response.status 帶到所拋出的錯誤上,並讓 isTranscriptNotFound 先檢查 status。在 transcriptDownload.server.test.ts 加入回歸測試,使用一個回應 HTTP/1.1 404 \r\nContent-Length: 0\r\n\r\n 的本機 TCP 伺服器;當該測試通過,且 transcript 測試套件、oxfmt、oxlint 與 webapp typecheck 皆維持綠燈時即完成。注意:連結的 PR #4987 已存在(已關閉、未合併),作者表示本機已有修正,因此開始前請先確認此 issue 尚無人認領。

由索引模型根據 Issue 內容生成。

描述

Provide environment information

Not environment-specific: found in the webapp source at main @ c2b7a72180 and reproduced with the webapp's own Vitest suite (macOS arm64, pnpm).

Describe the bug

A missing transcript can return 502 instead of 404 when the object store's 404 response has an empty reason phrase.

  • Aws4FetchClient.getObjectResponse (apps/webapp/app/v3/objectStoreClient.server.ts:135-141) throws an error built only from response.statusText and discards response.status:

    throw new Error(`Failed to download from object store: ${response.statusText}`);
    
  • isTranscriptNotFound (apps/webapp/app/services/realtime/transcriptDownload.server.ts:46-54) recognizes this adapter's missing object only by matching the message against /^Failed to download(?: range)? from object store: Not Found$/.

A valid HTTP/1.1 404 with no reason phrase gives the message Failed to download from object store: . It isn't classified as not found, so the route answers with a download failure (502).

Expected: a 404 from the object store is recognized by its status code, whatever the reason phrase says.

Reproduction repo

N/A (test against this repo, below)

To reproduce

In transcriptDownload.server.test.ts, start a local TCP server that replies HTTP/1.1 404 \r\nContent-Length: 0\r\n\r\n. Point ObjectStoreClient.create({ baseUrl: "http://127.0.0.1:<port>", service: "s3", ... }) at it, then:

await expect(client.getObjectResponse(key)).rejects.toSatisfy(isTranscriptNotFound);

On main this fails, because the error message is Failed to download from object store: and it isn't recognized.

Additional information

A fix with this regression test and a .server-changes note is ready locally:

  • the thrown error carries status: 404;
  • isTranscriptNotFound checks the status first.

The transcript suite (8 passed), oxfmt, oxlint and webapp typecheck pass. I'll open it as a draft PR with fixes #<this> once the account is vouched.

Prepared with AI assistance (Claude) from the breken-ai account.

主要語言
TypeScript
星號
16.5k
分支
1.5k
平均合併
1 天 15 小時
30 天內合併 PR
17

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

triggerdotdev/trigger.dev 的其他 Issue

查看 triggerdotdev/trigger.dev 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。