Request timeout does not cover stalled response bodies
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 74/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- typescript
- Ambito
- api
Direzione di ricerca
Inizia da src/core.ts:564-568 per seguire dove fetchWithTimeout cancella il suo timer, quindi leggi defaultParseResponse() in src/core.ts:70-91 e il contratto del timeout in README.md:135-154 e src/index.ts:62-69. Esegui la riproduzione fornita della risposta bloccata e verifica che la richiesta venga rifiutata con APIConnectionTimeoutError all’incirca dopo il timeout configurato, invece di rimanere in sospeso.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
The documented request timeout only lasts until fetch() resolves with response headers; it does not cover reading/parsing the response body.
fetchWithTimeout() clears its timer in src/core.ts:564-568 as soon as the fetch promise settles. defaultParseResponse() reads response.json()/response.text() later (src/core.ts:70-91) with no active timer. A server that sends headers and then stalls can therefore leave the SDK promise pending indefinitely, despite README.md stating that requests time out and throw APIConnectionTimeoutError.
Reproduction
import http from 'node:http';
import Browserbase from '@browserbasehq/sdk';
const server = http.createServer((_req, res) => {
res.writeHead(200, { 'content-type': 'application/json' });
res.write('{'); // send headers and a partial body, then stall
});
await new Promise<void>((resolve) => server.listen(0, '127.0.0.1', resolve));
const address = server.address();
if (!address || typeof address === 'string') throw new Error('missing port');
const client = new Browserbase({
apiKey: 'test',
baseURL: `http://127.0.0.1:${address.port}`,
timeout: 50,
maxRetries: 0,
});
const result = await Promise.race([
client.get('/stall').then(
() => 'resolved',
(error) => error.constructor.name,
),
new Promise<string>((resolve) => setTimeout(() => resolve('still pending'), 250)),
]);
console.log(result); // still pending, not APIConnectionTimeoutError
server.closeAllConnections();
server.close();
Expected behavior
The request rejects with APIConnectionTimeoutError around 50 ms, including time spent receiving/parsing the body.
Actual behavior
The request remains pending after 250 ms and can hang indefinitely.
Why this matters
A partial or slow response defeats the SDK's primary bound on request duration. This can exhaust application concurrency and contradicts the timeout contract documented in README.md:135-154 and ClientOptions in src/index.ts:62-69.
Tested with Node 22.14.0 against @browserbasehq/sdk 2.18.0 / current main (b781bd7).
- Lingua principale
- TypeScript
- Stelle
- 65
- Fork
- 17
- Merge medio
- 16m
- PR unite (30g)
- 2
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di browserbase/sdk-node
-
Binary ArrayBufferView slices send the entire backing bufferForse già presa @abhinavkr26104 l’ha presa 51 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
browserbase/sdk-node#202 ·
-
content-length header collision → InvalidArgumentError: invalid content-length header when a custom undici global dispatcher is installedForse già presa @edenbuilds l’ha presa 50 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
browserbase/sdk-node#197 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
browserbase/sdk-node#193 ·
-
[Bug] contexts.delete() fails with 400 — same Content-Type issue as extensions.delete() (#169)Forse già presa @edenbuilds l’ha presa 59 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
browserbase/sdk-node#180 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 66/100
browserbase/sdk-node#218 · 2 commenti ·
Tutte le issue di browserbase/sdk-node
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno