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

Ouverte
#4,984 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
25/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
À l'abandon
Stack technique
typescript
Domaine
backend

Piste de recherche

Commencez dans apps/webapp/app/v3/objectStoreClient.server.ts:135-141, où getObjectResponse lève une erreur en n'utilisant que response.statusText, et dans isTranscriptNotFound dans apps/webapp/app/services/realtime/transcriptDownload.server.ts:46-54, qui compare le message à une regex fixe "Not Found". Portez response.status sur l'erreur levée et faites en sorte que isTranscriptNotFound vérifie d'abord le statut. Ajoutez le test de non-régression dans transcriptDownload.server.test.ts en utilisant un serveur TCP local répondant HTTP/1.1 404 \r\nContent-Length: 0\r\n\r\n ; c'est terminé lorsque ce test passe et que la suite transcript, oxfmt, oxlint et le typecheck de la webapp restent au vert. Remarque : le PR #4987 lié existe (fermé, non fusionné) et l'auteur indique qu'un correctif est prêt en local, confirmez donc que le problème n'est pas pris avant de commencer.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
TypeScript
Étoiles
16.5k
Forks
1.5k
Merge moyen
1 j 15 h
PR mergées (30 j)
17

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de triggerdotdev/trigger.dev

Toutes les issues de triggerdotdev/trigger.dev

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.