{"id":47462,"library":"egg-grpc-client-ts","title":"egg-grpc-client-ts","description":"TypeScript gRPC client plugin for Egg.js framework, wrapping @grpc/grpc-js. Version 3.0.2 is the latest stable release with maintenance updates. Provides Egg-style declarative configuration for multiple gRPC clients, health checks, and distributed tracing via grpcMeta. Compared to egg-grpc-client, this plugin has TypeScript definitions and improved error metadata.","status":"active","version":"3.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/Jeff-Tian/egg-grpc-client-ts","tags":["javascript","egg","eggPlugin","egg-plugin","grpc"],"install":[{"cmd":"npm install egg-grpc-client-ts","lang":"bash","label":"npm"},{"cmd":"yarn add egg-grpc-client-ts","lang":"bash","label":"yarn"},{"cmd":"pnpm add egg-grpc-client-ts","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"gRPC client implementation","package":"@grpc/grpc-js","optional":false},{"reason":"Egg.js framework dependency for plugin loading and configuration","package":"egg","optional":false}],"imports":[{"note":"Plugin name in config must match the package name exactly.","wrong":"exports.grpcClient = { enable: true, package: 'egg-grpc-client' };","symbol":"grpcClient plugin config","correct":"exports.grpcClient = { enable: true, package: 'egg-grpc-client-ts' };"},{"note":"Clients are obtained via app.grpcClient.getClient(name), not instantiated directly.","wrong":"const client = new GrpcClient();","symbol":"gRPC client usage","correct":"const client = app.grpcClient.getClient('main'); const result = await client.sayHello({ name: 'world' });"},{"note":"Use `import type` for type-only imports to avoid runtime errors.","wrong":"import { GrpcClient } from 'egg-grpc-client-ts';","symbol":"TypeScript type imports","correct":"import type { GrpcClient } from 'egg-grpc-client-ts';"}],"quickstart":{"code":"// config/plugin.ts\nexports.grpcClient = {\n  enable: true,\n  package: 'egg-grpc-client-ts',\n};\n\n// config/config.default.ts\nexports.grpcClient = {\n  clients: [\n    {\n      name: 'main',\n      protoPath: 'app/proto/helloworld.proto',\n      host: process.env.GRPC_HOST ?? 'localhost',\n      port: Number(process.env.GRPC_PORT ?? '50051'),\n    },\n  ],\n};\n\n// app/service/Greeter.ts\nimport { Application } from 'egg';\nexport default class GreeterService extends app.Service {\n  async sayHello(name: string) {\n    const client = this.app.grpcClient.getClient('main');\n    return client.sayHello({ name });\n  }\n}","lang":"typescript","description":"Configures the egg-grpc-client-ts plugin and uses it in an Egg.js service to call a gRPC service."},"warnings":[{"fix":"Upgrade to Node.js 10+ or stay on v1.x.","message":"Version 2.x drops Node.js 8 support; minimum Node is 10.","severity":"breaking","affected_versions":">=2.0.0 <3.0.0"},{"fix":"Ensure @grpc/grpc-js is installed (it's a dependency). Update any direct requires of 'grpc' to '@grpc/grpc-js'.","message":"Version 3.0.0 changes gRPC library from grpc to @grpc/grpc-js.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use ES module syntax: `export default { grpcClient: { enable: true, package: 'egg-grpc-client-ts' } };`","message":"Using CommonJS require() for plugin config is deprecated as of Egg 3.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Wrap client calls with retry logic or use a higher-level library that supports reconnection.","message":"The plugin does not automatically reconnect on connection loss. You must implement reconnection logic or use a connection pool.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'3.0.2':16 'check':36 'client':4,8,34,47 'compar':42 'configur':30 'declar':29 'definit':52 'distribut':38 'egg':2,27,45,58,61 'egg-grpc-client':44 'egg-grpc-client-t':1 'egg-plugin':60 'egg-styl':26 'egg.js':11 'eggplugin':59 'error':55 'framework':12 'grpc':3,7,33,46,63 'grpc/grpc-js':14 'grpcmeta':41 'health':35 'improv':54 'javascript':57 'latest':19 'mainten':23 'metadata':56 'multipl':32 'plugin':9,49,62 'provid':25 'releas':21 'stabl':20 'style':28 'trace':39 'ts':5 'typescript':6,51 'updat':24 'version':15 'via':40 'wrap':13","created_at":"2026-06-07T16:51:38.405039+00:00","updated_at":"2026-06-07T16:51:38.405039+00:00","problems":[{"fix":"Run `npm install @grpc/grpc-js` and update imports to use '@grpc/grpc-js'.","cause":"Version 3.x uses @grpc/grpc-js instead of grpc.","error":"Error: Cannot find module 'grpc'"},{"fix":"Check plugin.ts: exports.grpcClient = { enable: true, package: 'egg-grpc-client-ts' }; Also ensure plugin directory is in egg's plugin path.","cause":"Plugin not enabled or not loaded correctly.","error":"TypeError: app.grpcClient.getClient is not a function"},{"fix":"Set exports.grpcClient = { clients: [{ name, protoPath, host, port }] };","cause":"Missing or malformed config.default.js exports.grpcClient.clients.","error":"Error: grpcClient config missing clients array"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/Jeff-Tian/egg-grpc-client-ts","github":"https://github.com/Jeff-Tian/egg-grpc-client-ts","docs":null,"changelog":null,"pypi":null,"npm":"egg-grpc-client-ts","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}