Registry / http-networking / resilient

resilient

JSON →
library51.0.8.0.30103jsnpmunverified

A fault-tolerant, reactive HTTP client for Node.js and browsers, designed for distributed systems and microservices. Version 0.4.0 (latest, last released in 2016, no recent updates) provides transparent server fallback, dynamic server discovery (e.g., via Consul), request retry/backoff, and client-side load balancing based on empirical server latency. It is middleware-oriented, lightweight (~9KB gzipped), dependency-free, and supports both callback and promise-based async requests. Differentiates from alternatives like Axios or Got by focusing on resilience patterns (circuit breaker, failover) inspired by Netflix's Ribbon and Chaos Engineering.

npm install resilient
INSTALL
IMPORT
SIG · RESILIENT
R
resilient
http-networkingjavascriptv51.0.8.0.30103
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

resilient
const resilient = require('resilient');
import resilient from 'resilient';
CJS only; no ESM support.
ResilientClient
const client = resilient({ service: { basePath: '/api' } });
const client = new resilient.Client();
The factory function returns a client instance; no class constructor.
middleware
client.use(middleware());
client.use('middleware');
Middleware must be a function, not a string.

Creates a resilient client with static server discovery, retry, fallback, and round-robin load balancing, then performs a GET request.

const resilient = require('resilient'); const client = resilient({ service: { basePath: '/api', timeout: 5000, retry: 2, fallback: true }, discovery: { servers: ['http://server1.example.com', 'http://server2.example.com'], interval: 30000 }, balancer: { policy: 'roundRobin' } }); client.get('/users', (err, res) => { if (err) { console.error('Request failed:', err.message); } else { console.log('Response:', res.body); } });
Debug
Known issues
deprecatedThe package has not been updated since 2016; it uses outdated APIs and may not work with modern Node.js versions.
fix
Consider migrating to a maintained alternative like Axios with retry plugins or Got with timeout and retry.
affects: >=0.4.0
breakingNode.js 4+ required; incompatible with Node.js versions below 4.
fix
Upgrade Node.js to version 4 or higher.
affects: <4
gotchaThe client does not support promises natively (callback only). Using promises requires wrapping or a library like Bluebird.
fix
Use client.get().then() is not available; wrap callbacks in promises.
affects: >=0.1.0
gotchaErrors from the client use custom error codes (e.g., 'RERR_REQUEST_FAILED'). Standard HTTP errors may not be caught.
fix
Check for err.code and compare with resilient error constants.
affects: >=0.1.0
gotchaThe discovery interval and retry count are global; cannot be overridden per-request.
fix
Set discovery options in constructor; no per-request override available.
affects: >=0.1.0
Errors
Common errors & fixes
module 'resilient' not found
Package not installed or missing from node_modules.
fix
Run 'npm install resilient --save'.
Uncaught TypeError: resilient is not a function
Incorrect import: using ES6 import syntax or destructuring import.
fix
Use const resilient = require('resilient');
TypeError: client.get is not a function
client is not properly initialized; perhaps called before module loaded or factory not invoked.
fix
Ensure resilient() is called with options and returns client object.
Error: connect ECONNREFUSED
No servers available or discovery fails; default server list empty.
fix
Configure at least one server in discovery.servers or provide dynamic discovery URL.
Cannot read property 'body' of undefined
The callback is called with (err, res) but res is undefined when error occurs.
fix
Check if err is truthy before accessing res.body.
Upgrade
Version history
51.0.8.0.30103latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
12
OpenAI (training)
2
Resources
resilient — npm install resilient · libregistry