Registry / devops / grpc-conn-pool

grpc-conn-pool

JSON →
library1.0.6jsnpmunverified

gRPC connection pool for Node.js (version 1.0.6). Maintains a pool of gRPC client connections to reuse, reducing connection overhead. Minimal API: constructs a pool with `require('grpc-conn-pool')`, then gets a connection via `.getConnection()`. No active development. Supports only CommonJS. Key differentiator: lightweight, simple, no external dependencies beyond @grpc/grpc-js. Last updated 2021.

npm install grpc-conn-pool
INSTALL
IMPORT
SIG · GRPC-CONN-POOL
G
grpc-conn-pool
devopsjavascriptv1.0.6
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.

default
const Pool = require('grpc-conn-pool');
import Pool from 'grpc-conn-pool';
CJS-only; ESM import will fail. Use require().
Pool
const Pool = require('grpc-conn-pool');
const { Pool } = require('grpc-conn-pool');
Default export; named import is incorrect.
pool.getConnection
const conn = pool.getConnection();
pool.getConnection(credentials);
No arguments needed; connection is pre-configured with Client class.

Shows how to create a connection pool for a gRPC client, get a connection, use it, and release it back.

const grpc = require('@grpc/grpc-js'); const Pool = require('grpc-conn-pool'); const protoLoader = require('@grpc/proto-loader'); const packageDefinition = protoLoader.loadSync('helloworld.proto'); const helloProto = grpc.loadPackageDefinition(packageDefinition).helloworld; const pool = new Pool({ Client: helloProto.Greeter, address: 'localhost:50051', credentials: grpc.credentials.createInsecure(), poolSize: 10, maxAge: 60000 }); const client = pool.getConnection(); client.sayHello({ name: 'World' }, (err, response) => { console.log('Greeting:', response.message); pool.releaseConnection(client); });
Debug
Known issues
breakingOnly supports CommonJS; ESM import will throw require() is not defined.
fix
Use require() or migrate to ESM-compatible library.
affects: >=1.0.0
gotchapool.getConnection() returns a client instance; do not call new on it.
fix
Use pool.getConnection() directly; it returns a pre-constructed client.
affects: >=1.0.0
gotchapool.releaseConnection() must be called after use; otherwise pool leaks connections.
fix
Always call pool.releaseConnection(client) in a finally block.
affects: >=1.0.0
deprecatedPackage is not actively maintained; last update in 2021.
fix
Consider using @grpc/grpc-js with built-in channel pooling, or other maintained pools.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'grpc-conn-pool'
Package not installed
fix
npm install grpc-conn-pool
TypeError: Pool is not a constructor
Using named import instead of default
fix
const Pool = require('grpc-conn-pool');
TypeError: pool.getConnection is not a function
Pool not instantiated properly
fix
Ensure Pool is called with `new` and valid options.
Error: Failed to connect to gRPC server: 14 UNAVAILABLE
Server not reachable or wrong address
fix
Check server address and credentials.
Upgrade
Version history
1.0.6latest on npm
Audit
Dependencies
@grpc/grpc-jsrequiredpeer dependency for gRPC client
Agent activity
6 hits · last 30 days
node
6
Resources
grpc-conn-pool — npm install grpc-conn-pool · libregistry