Registry / devops / egg-grpc-client-ts-plus

egg-grpc-client-ts-plus

JSON →
library1.1.2jsnpmunverified

TypeScript plugin for Egg.js to provide gRPC client functionality. Version 1.1.2, no active release cadence indicated. Forked from egg-grpc-client-ts, it adds configurable max_send_message_length and max_receive_message_length to the gRPC client setup. Designed for Egg.js framework applications requiring gRPC communication. Not actively maintained, limited documentation.

npm install egg-grpc-client-ts-plus
INSTALL
IMPORT
SIG · EGG-GRPC-CLIENT-TS
E
egg-grpc-client-ts-plus
devopsjavascriptv1.1.2
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.

grpcClient config in plugin.js
// {app_root}/config/plugin.ts exports.grpcClient = { enable: true, package: 'egg-grpc-client-ts-plus' };
// Do not require('egg-grpc-client-ts-plus') directly in code; configure in plugin.js only.
This is an Egg.js plugin, not a regular module. Importing directly will not work.
Configuration in config.default.ts
// {app_root}/config/config.default.ts exports.grpcClient = { clients: [ { name: 'main', protoPath: 'app/proto/main', host: '0.0.0.0', port: 50051 } ] };
// Do not set exports.grpcClient as a function; it must be an object with clients array.
Configuration is read automatically by Egg.js plugin system.
Using the client in service
const client = this.app.grpcClient.getClient('main');
// Do not call app.grpcClient.getClient before plugin is enabled.
Access via this.app.grpcClient after plugin setup.

Basic setup of egg-grpc-client-ts-plus in an Egg.js project: plugin registration, configuration, and usage to connect to a gRPC server.

// Install plugin // npm i egg-grpc-client-ts-plus --save // {app_root}/config/plugin.ts exports.grpcClient = { enable: true, package: 'egg-grpc-client-ts-plus', }; // {app_root}/config/config.default.ts exports.grpcClient = { clients: [ { name: 'main', protoPath: 'app/proto/main', host: '0.0.0.0', port: 50051, maxSendMessageLength: -1, maxReceiveMessageLength: 4 * 1024 * 1024, }, ], }; // In service: app.grpcClient.getClient('main') to get gRPC client instance.
Debug
Known issues
deprecatedPackage uses old-style Egg.js plugin conventions; not compatible with Egg.js 3.x new plugin system without migration.
fix
Consider using '@eggjs/grpc-client' or newer alternatives.
affects: >=1.0.0
gotchaThe package name in npm is 'egg-grpc-client-ts-plus' but plugin configuration uses 'grpcClient' as key. Ensure consistency.
fix
Use 'grpcClient' as the plugin key in config/plugin.js.
affects: >=1.0.0
gotchaConfig option 'maxSendMessageLength' and 'maxReceiveMessageLength' are optional but default to -1 for send length which may cause issues.
fix
Explicitly set maxSendMessageLength and maxReceiveMessageLength as needed.
affects: >=1.0.0
gotchaIf protoPath does not exist, the plugin will throw at startup. No built-in validation.
fix
Ensure proto files exist at the specified path.
affects: >=1.0.0
deprecatedgRPC client uses @grpc/grpc-js v1.x but older versions may have breaking changes.
fix
Update @grpc/grpc-js to latest compatible version.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'egg-grpc-client-ts-plus'
Package not installed or not properly enabled in plugin.js
fix
Run npm install, then check plugin.js has exports.grpcClient = { enable: true, package: 'egg-grpc-client-ts-plus' }
config.grpcClient.clients is not an array
Configuration format wrong; it must be an array of client objects.
fix
Set exports.grpcClient = { clients: [ { name: 'main', ... } ] }
TimeoutError: Deadline Exceeded
gRPC server not reachable or proto definitions mismatched.
fix
Check server host/port and proto file correctness.
Upgrade
Version history
1.1.2latest on npm
Audit
Dependencies
@grpc/grpc-jsrequiredCore gRPC implementation
eggrequiredEgg.js framework dependency
Agent activity
4 hits · last 30 days
node
4
Resources
egg-grpc-client-ts-plus — npm install egg-grpc-client-ts-plus · libregistry