Skip to content
Back to snapcart-api report
ReliabilityMedium

Outbound Requests Without Timeout

src/client/throttle.ts:21

What's going on

External API calls are never given a timeout, so a hanging third-party service can pin Node workers indefinitely until they exhaust the process pool.

Why it matters

A single slow dependency can take the whole service down. Timeouts turn a slow-failure scenario into a fast, contained one.

src/client/throttle.ts:21

Recommended Fix

Replace the inline query with a parameterized statement and validate the id before it ever reaches the database. A regression test is generated alongside the patch.

Before
1export function fetchFromProvider(url: string) {2  // no timeout ever applied3  return fetch(url).then((r) => r.json());4}
After
1export function fetchFromProvider(url: string) {2  return fetch(url, {3    signal: AbortSignal.timeout(5_000), // bounded4  }).then((r) => r.json());5}
  1. Uploaddone
  2. Analyzedone
  3. Finddone
  4. Explainactive
  5. Fixupcoming
  6. Testupcoming
  7. Verifyupcoming