Registry / storage / grpc-sdk-client

grpc-sdk-client

JSON →
library1.5.0jsnpmunverified

A Node.js gRPC client library that provides round-robin load balancing across multiple server endpoints. Version 1.5.0 is the latest stable release. It simplifies connecting to gRPC services by auto-loading .proto files and exposing a simple exec() function for RPC calls. Differentiators include built-in load balancing and minimal setup, though it lacks advanced features like health checking or retry logic present in grpc-js. The library appears to be in maintenance mode with no recent updates.

npm install grpc-sdk-client
INSTALL
IMPORT
SIG · GRPC-SDK-CLIENT
G
grpc-sdk-client
storagejavascriptv1.5.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.

default
const rpc = require('grpc-sdk-client')
The package exports a single object with init and exec methods. ESM import may not be supported.
init
rpc.init(protoPath, packageName, serviceName, servers)
rpc.init(protoPath, serviceName, servers) // missing packageName argument
Requires exactly 4 arguments: proto file path, proto package name, service name, and array of {host,port} objects.
exec
rpc.exec(methodName, requestData, callback)
const result = await rpc.exec(methodName, requestData) // exec does not return a promise, use callback
The exec function uses a callback pattern, not Promises. You must wrap it in a Promise if you want async/await.

Demonstrates initializing the gRPC client with a .proto file and multiple servers, then making an RPC call wrapped in a Promise for async/await usage.

const rpc = require('grpc-sdk-client'); // Initialize the client with proto file, package, service, and server list rpc.init( './auth.proto', 'auth_rpc', 'CheckAuth', [ { host: 'localhost', port: 50051 }, { host: 'localhost', port: 50052 } ] ); // Make a call using exec with callback function checkUser(token, method, url) { return new Promise((resolve, reject) => { rpc.exec('check', { token, method, url }, (err, res) => { if (err) reject(err); else resolve(res); }); }); } // Usage checkUser('abc123', 'GET', '/api/users').then(console.log).catch(console.error);
Debug
Known issues
deprecatedPackage uses the 'grpc' package (grpc@1.24.x) which is deprecated. Use '@grpc/grpc-js' instead.
fix
Migrate to '@grpc/grpc-js' or use 'grpc-js' based client.
affects: all
gotchaVariables may conflict if multiple RPC services use the same method name.
fix
Use unique method names within a service or manage multiple clients.
affects: all
gotchaexec() does not return a Promise; using it with await will result in undefined.
fix
Wrap in a Promise manually: new Promise((resolve, reject) => rpc.exec(...))
affects: all
Errors
Common errors & fixes
Error: ENOENT: no such file or directory, open '.../auth.proto'
The proto file path passed to init() is incorrect or relative path not resolved.
fix
Use __dirname + '/relative/path/to/auth.proto' or absolute path.
Error: service not found
The provided package name or service name does not match the proto definition.
fix
Ensure the package name (e.g., 'auth_rpc') matches the 'package' line in .proto, and service name (e.g., 'CheckAuth') matches exactly.
TypeError: rpc.exec is not a function
The init() function was not called successfully or the module was not required correctly.
fix
Ensure you require('grpc-sdk-client') and call init() before exec(). Check for errors during init.
Upgrade
Version history
1.5.0latest on npm
Audit
Dependencies
grpcoptionalThe underlying gRPC implementation used for RPC communication
Agent activity
18 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
grpc-sdk-client — npm install grpc-sdk-client · libregistry