Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Retryable responses are abandoned without canceling their bodies

Open
#204 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
node.js, typescript
Domain
api

Research direction

Start at the retry branch in src/core.ts:490-495 and run the provided reproduction to observe the un-canceled response body. Add runtime-compatible cleanup before retryRequest(), then test cancellation for both Web and Node stream implementations, confirming the first response is canceled before the retry.

Written by the indexing model from the issue text.

Description

Description

When an HTTP response is retryable, the SDK starts the next attempt without consuming or canceling the previous response body.

The early return at src/core.ts:490-495 bypasses response.text() and does not call response.body.cancel() (or the runtime-equivalent cleanup) before retryRequest().

Reproduction
import Browserbase from '@browserbasehq/sdk';

let attempts = 0;
let cancelCalls = 0;
const client = new Browserbase({
  apiKey: 'test',
  maxRetries: 1,
  fetch: async () => {
    attempts++;
    if (attempts === 1) {
      const body = new ReadableStream({
        cancel() {
          cancelCalls++;
        },
      });
      return new Response(body, {
        status: 500,
        headers: { 'content-type': 'text/plain' },
      });
    }
    return new Response('{}', {
      status: 200,
      headers: { 'content-type': 'application/json' },
    });
  },
});

await client.get('/retry');
console.log(cancelCalls); // 0
Expected behavior

The unused body of the first response is canceled before retrying (cancelCalls === 1).

Actual behavior

The response is abandoned without cancellation (cancelCalls === 0).

Why this matters

With streaming or large error responses, abandoning the body can keep sockets and stream resources occupied, reduce connection reuse, and accumulate resources across repeated 429/5xx responses. The retry branch should explicitly cancel the body in a runtime-compatible way and test both Web and Node stream implementations.

Tested against @browserbasehq/sdk 2.18.0 / current main (b781bd7).

Dominant language
TypeScript
Stars
64
Forks
17
Avg merge
13m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from browserbase/sdk-node

All issues in browserbase/sdk-node

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.