Registry / devops / async-bulkhead-fetch

async-bulkhead-fetch

JSON →
library0.2.0jsnpmunverified

Fail-fast admission control for outbound fetch calls, built on async-bulkhead-ts. Version 0.2.0. Released as needed. Limits concurrent fetch requests to protect downstream HTTP services, rejecting early when capacity is full. Provides optional bounded queueing with timeouts, response-body-aware capacity release, and hooks for stats, close, and drain. Differentiates from rate limiters and circuit breakers by focusing solely on local concurrency enforcement with zero distributed coordination.

npm install async-bulkhead-fetch
INSTALL
IMPORT
SIG · ASYNC-BULKHEAD-FET
A
async-bulkhead-fetch
devopsjavascriptv0.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createBulkheadFetch
import { createBulkheadFetch } from 'async-bulkhead-fetch'
const createBulkheadFetch = require('async-bulkhead-fetch')
ESM-only since v0.1.0; no CommonJS support. TypeScript types included.
createFetchBulkhead
import { createFetchBulkhead } from 'async-bulkhead-fetch'
import { createBulkheadFetch } from 'async-bulkhead-fetch'
Do not confuse with createBulkheadFetch. createFetchBulkhead returns an object with fetch, stats, close, drain methods.
FetchBulkheadRejectedError
import { FetchBulkheadRejectedError } from 'async-bulkhead-fetch'
import { FetchBulkheadRejected } from 'async-bulkhead-fetch'
Error class for rejected calls; has reason property with string union type.

Creates a guarded fetch that limits concurrent requests to 10 and rejects immediately when full. Shows how to import and use createBulkheadFetch.

import { createBulkheadFetch, FetchBulkheadRejectedError } from 'async-bulkhead-fetch'; const guardedFetch = createBulkheadFetch({ name: 'payments-api', maxConcurrent: 10, maxQueue: 0, }); const payload = { amount: 500, currency: 'usd' }; try { const response = await guardedFetch('https://payments.example.com/charge', { method: 'POST', body: JSON.stringify(payload), headers: { 'content-type': 'application/json' }, }); const data = await response.json(); console.log(data); } catch (err) { if (err instanceof FetchBulkheadRejectedError) { console.error('Request rejected by bulkhead:', err.reason); } else { console.error('Fetch failed:', err); } }
Debug
Known issues
breakingNode.js 20+ required. Will throw on Node.js <20 due to native fetch usage.
fix
Upgrade Node.js to version 20 or later.
affects: >=0.1.0
deprecatedNo deprecated patterns in current version.
fix
No action needed.
affects: >=0.1.0
gotchamaxQueue must be a non-negative integer; setting to 0 disables queuing. queueWaitTimeoutMs only applies when queue is in use.
fix
Provide sensible values for maxConcurrent and maxQueue based on downstream capacity.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'async-bulkhead-fetch'
Package not installed or npm install not run.
fix
Run 'npm install async-bulkhead-fetch' and ensure package.json includes it.
ReferenceError: fetch is not defined
Running on Node.js <20 without global fetch.
fix
Upgrade Node.js to v20+ or provide a custom fetch implementation via options.
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies
async-bulkhead-tsrequiredCore bulkhead logic for concurrency limiting, queueing, and state management.
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
async-bulkhead-fetch — npm install async-bulkhead-fetch · libregistry