Registry / devops / andela-grpc-caller

andela-grpc-caller

JSON →
library0.3.13jsnpmunverified

An improved Node.js gRPC client that provides promisified request/response calls and automatic Metadata creation from plain JavaScript objects. Current stable version 0.3.13. The module wraps standard gRPC client calls, allowing use with async/await and callbacks, and simplifies stream handling. It uses grpc-create-metadata to automatically convert plain objects to gRPC Metadata. Alternative to raw gRPC-js client with easier async patterns.

npm install andela-grpc-caller
INSTALL
IMPORT
SIG · ANDELA-GRPC-CALLER
A
andela-grpc-caller
devopsjavascriptv0.3.13
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.

caller (default)
import caller from 'grpc-caller'
const caller = require('grpc-caller').default
ESM default import; CommonJS usage is const caller = require('grpc-caller')
caller (CommonJS)
const caller = require('grpc-caller')
const { caller } = require('grpc-caller')
Module exports a single function, not a named export
TypeScript
import caller from 'grpc-caller'
import * as caller from 'grpc-caller'
Module is not typed; use @types/grpc-caller or declare module

Shows basic usage of grpc-caller to create a client and make a promisified RPC call with async/await.

import path from 'path'; import caller from 'grpc-caller'; const PROTO_PATH = path.resolve('./protos/helloworld.proto'); const client = caller('0.0.0.0:50051', PROTO_PATH, 'Greeter'); // Promisified call async function main() { const response = await client.sayHello({ name: 'World' }); console.log('Greeting:', response.message); } main().catch(console.error);
Debug
Known issues
deprecatedgrpc-caller depends on the 'grpc' package which is deprecated in favor of '@grpc/grpc-js'.
fix
Migrate to '@grpc/grpc-js' and consider using '@grpc/proto-loader' directly with promisification or use a wrapper that supports the new package.
affects: >=0.1.0
gotchaAutomatic Metadata creation may override existing metadata properties if plain object keys conflict with gRPC Metadata internal fields.
fix
Use explicit Metadata instance when custom handling is needed, or avoid keys that are reserved by gRPC Metadata.
affects: >=0.1.0
gotchaThe module only promisifies request/response and request stream/response calls; client streaming and bidi streaming calls are not enhanced differently.
fix
For client streaming or bidi streaming, use standard gRPC client methods or manually promisify.
affects: >=0.1.0
breakingVersion 0.3.x changed the behavior of Metadata creation: now it merges with existing metadata instead of replacing.
fix
If relying on previous behavior where Metadata was fully replaced, upgrade with caution.
affects: >=0.3.0
gotchaThe module does not support the modern '@grpc/grpc-js' package; only works with the deprecated 'grpc' package.
fix
Use 'grpc' package or choose an alternative that supports '@grpc/grpc-js'.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'grpc'
The 'grpc' package is not installed or is not in node_modules.
fix
Run npm install grpc to install the deprecated gRPC package.
TypeError: client.sayHello is not a function
The proto file path or service name is incorrect; the client method does not exist.
fix
Verify the PROTO_PATH and service name. Ensure the protobuf file defines the correct service and RPC method.
TypeError: Cannot read property 'sayHello' of undefined
The caller function returned undefined, likely due to an error in proto loading or connection.
fix
Check that the gRPC server is running and the host:port is correct. Validate the proto file path.
Upgrade
Version history
0.3.13latest on npm
Audit
Dependencies
grpcrequiredCore gRPC library required for client functionality
grpc-create-metadatarequiredUsed to automatically create Metadata from plain JavaScript objects
Agent activity
18 hits · last 30 days
node
14
OpenAI (training)
1
Resources
andela-grpc-caller — npm install andela-grpc-caller · libregistry