Provide environment information
Not environment-specific: found in the webapp source at main @ c2b7a72 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.
Provide environment information
Not environment-specific: found in the webapp source at
main@ c2b7a72 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 fromresponse.statusTextand discardsresponse.status: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 404with no reason phrase gives the messageFailed 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 repliesHTTP/1.1 404 \r\nContent-Length: 0\r\n\r\n. PointObjectStoreClient.create({ baseUrl: "http://127.0.0.1:<port>", service: "s3", ... })at it, then: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-changesnote is ready locally:status: 404;isTranscriptNotFoundchecks 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.