{"id":47466,"library":"egg-grpc","title":"egg-grpc","description":"gRPC plugin for the Egg.js framework (version 1.0.3). Integrates gRPC client functionality into Egg applications by automatically loading protocol buffer files from a configurable directory, attaching service stubs to ctx and app objects. Supports proto file discovery, name conversion between protobuf conventions and JavaScript, and unary RPC calls. Requires Egg.js and gRPC dependencies. Last updated in 2018 and appears to be in maintenance mode with no recent activity.","status":"maintenance","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/eggjs/egg-grpc","tags":["javascript","egg","eggPlugin","egg-plugin","grpc"],"install":[{"cmd":"npm install egg-grpc","lang":"bash","label":"npm"},{"cmd":"yarn add egg-grpc","lang":"bash","label":"yarn"},{"cmd":"pnpm add egg-grpc","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Egg.js framework plugin, requires Egg application","package":"egg","optional":false},{"reason":"gRPC client library for Node.js (the legacy grpc package)","package":"grpc","optional":false}],"imports":[{"note":"Configure in config/plugin.js using plugin syntax","wrong":"module.exports.grpc = ...","symbol":"exports.grpc","correct":"exports.grpc = { enable: true, package: 'egg-grpc' }"},{"note":"Configure endpoint and options in config/config.default.js","wrong":"module.exports.grpc = ...","symbol":"config.grpc","correct":"exports.grpc = { endpoint: 'localhost:50051' }"},{"note":"Access gRPC client methods via ctx.grpc.<package>.<service>.<rpc> (camelCase)","wrong":"ctx.grpc()","symbol":"ctx.grpc","correct":"const client = ctx.grpc.packageName.serviceName.rpcName"},{"note":"Proto message classes are on app.grpcProto, not app.grpc","wrong":"app.grpc.messageClass","symbol":"app.grpcProto","correct":"const msg = new app.grpcProto.packageName.MessageName({...})"}],"quickstart":{"code":"// {app_root}/config/plugin.js\nexports.grpc = {\n  enable: true,\n  package: 'egg-grpc',\n};\n\n// {app_root}/config/config.default.js\nexports.grpc = {\n  endpoint: 'localhost:50051', // gRPC server address\n  // dir: 'app/proto',          // default directory for .proto files\n  // property: 'grpc',          // default property name on ctx\n};\n\n// Assume app/proto/share.proto with:\n// package egg.share;\n// service ShowCase { rpc Echo(Status) returns (Status); }\n// message Status { string code = 1; string err_msg = 2; }\n\n// In a controller or service (using async/await or generator):\nconst client = ctx.grpc.egg.share.showCase;\nconst result = await client.echo({ code: '200' });\nconsole.log(result); // { code: '200', err_msg: '' }","lang":"javascript","description":"Shows how to enable the plugin, configure endpoint, and make a unary gRPC call from a controller using the client attached to ctx."},"warnings":[{"fix":"Switch to a more modern gRPC plugin or adjust the plugin to use @grpc/grpc-js.","message":"The legacy grpc package is deprecated; use @grpc/grpc-js instead.","severity":"deprecated","affected_versions":"<=1.0.3"},{"fix":"If you need @grpc/grpc-js, you must fork or rewrite the plugin.","message":"This plugin uses the full 'grpc' package, which is not compatible with @grpc/grpc-js in some cases.","severity":"breaking","affected_versions":"<=1.0.3"},{"fix":"Use the package name as defined in .proto files, not the file path.","message":"Proto file paths do not affect the namespace on ctx; only the proto package definition matters.","severity":"gotcha","affected_versions":"all"},{"fix":"For service ShowCase, access as ctx.grpc.egg.share.showCase, not ShowCase.","message":"Service and rpc names are converted to camelCase when accessed via ctx.grpc.","severity":"gotcha","affected_versions":"all"},{"fix":"Use ctx.grpc for making RPC calls, not app.grpc.","message":"You cannot call rpcs via app.grpc; use ctx.grpc for invoking RPCs (app.grpcProto is for message constructors).","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'1.0.3':11 '2018':60 'activ':71 'app':35 'appear':62 'applic':18 'attach':29 'automat':20 'buffer':23 'call':51 'client':14 'configur':27 'convent':45 'convers':42 'ctx':33 'depend':56 'directori':28 'discoveri':40 'egg':2,17,73,76 'egg-grpc':1 'egg-plugin':75 'egg.js':8,53 'eggplugin':74 'file':24,39 'framework':9 'function':15 'grpc':3,4,13,55,78 'integr':12 'javascript':47,72 'last':57 'load':21 'mainten':66 'mode':67 'name':41 'object':36 'plugin':5,77 'proto':38 'protobuf':44 'protocol':22 'recent':70 'requir':52 'rpc':50 'servic':30 'stub':31 'support':37 'unari':49 'updat':58 'version':10","created_at":"2026-06-07T16:51:39.593979+00:00","updated_at":"2026-06-07T16:51:39.593979+00:00","problems":[{"fix":"npm install grpc --save (note: grpc is deprecated).","cause":"grpc package is not installed or not listed in dependencies.","error":"Error: Cannot find module 'grpc'"},{"fix":"Ensure config/plugin.js has exports.grpc = { enable: true, package: 'egg-grpc' } and the package is installed.","cause":"egg-grpc plugin not enabled or not properly configured.","error":"TypeError: ctx.grpc is undefined"},{"fix":"Create the directory or update the config to point to an existing directory.","cause":"The proto directory specified in config.grpc.dir does not exist.","error":"Error: ENOENT: no such file or directory, open '...'"}],"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/eggjs/egg-grpc#readme","github":"https://github.com/eggjs/egg-grpc","docs":null,"changelog":null,"pypi":null,"npm":"egg-grpc","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}}