Skip to content

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

Description

@breken-ai

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions