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

Đang mở
#4,984 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
typescript
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu tại apps/webapp/app/v3/objectStoreClient.server.ts:135-141, nơi getObjectResponse ném lỗi chỉ dùng response.statusText, và tại isTranscriptNotFound trong apps/webjapp/app/services/realtime/transcriptDownload.server.ts:46-54, hàm này khớp thông điệp với một regex cố định "Not Found". Truyền response.status lên lỗi được ném và để isTranscriptNotFound kiểm tra status trước. Thêm test hồi quy trong transcriptDownload.server.test.ts dùng một máy chủ TCP cục bộ trả lời HTTP/1.1 404 \r\nContent-Length: 0\r\n\r\n; hoàn tất khi test đó pass và suite transcript, oxfmt, oxlint cùng typecheck của webapp vẫn xanh. Lưu ý: PR liên kết #4987 tồn tại (đã đóng, chưa merge) và tác giả cho biết một bản sửa đã sẵn sàng cục bộ, vì vậy hãy xác nhận issue chưa được nhận trước khi bắt đầu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
16.5k
Fork
1.5k
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
17

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của triggerdotdev/trigger.dev

Tất cả issue của triggerdotdev/trigger.dev

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.