nice-grpc-server-reflection is a package within the nice-grpc ecosystem that provides gRPC server reflection capabilities for Node.js servers built with nice-grpc. Currently at version 3.0.4, it enables external gRPC tools like `grpcurl`, Postman, or client libraries to dynamically discover and introspect the server's exposed services, methods, and their protobuf message definitions at runtime without requiring pre-compiled `.proto` files on the client side. The library integrates seamlessly with the `nice-grpc` server, accepting a pre-generated protobuf descriptor set (.bin file) and a list of fully-qualified service names. As part of the actively maintained `nice-grpc` monorepo, it receives frequent updates, leveraging nice-grpc's TypeScript-first design, modern Promises/Async Iterables API, and robust middleware support. Its primary differentiator is its tight integration and idiomatic usage within the `nice-grpc` framework, providing a clear path for enabling standard gRPC reflection in TypeScript-based Node.js gRPC services.
npm install nice-grpc-server-reflectionVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to set up a nice-grpc server, define a simple gRPC service, generate a protobuf descriptor set, and enable the gRPC Server Reflection service. It includes the necessary `protoc` command to create the `.bin` file and shows how to integrate it with `nice-grpc`, allowing tools like `grpcurl` to inspect the running server's API.
Ensure `nice-grpc`, `@grpc/grpc-js`, and `nice-grpc-server-reflection` are updated to compatible versions, ideally the latest stable releases. If using `ts-proto`, verify your `ts_proto_opt` settings include `outputServices=nice-grpc` and other recommended options for consistency. Review GitHub issues on the `nice-grpc` monorepo (e.g., #611) for specific version conflicts.
Always use `protoc --descriptor_set_out=path/to/output.bin --include_imports -I./proto_dir your_service.proto` ensuring `proto_dir` contains all imported `.proto` files.
Limit exposure of the reflection service to internal networks, development environments, or authorized clients only. Use appropriate network segmentation, firewalls, or authentication mechanisms to control access.
Double-check that the string array provided to `ServerReflection` contains the exact fully-qualified service names as defined in your protobuf schemas. For example, `package my.app; service MyService {}` would be `['my.app.MyService']`.Update `nice-grpc` and `nice-grpc-server-reflection` to compatible versions. If `ts-proto` is used, ensure `outputServices=nice-grpc,outputServices=generic-definitions` and `esModuleInterop=true` are configured during proto generation.
Verify the `protoc` command used to generate `protoset.bin` includes `--descriptor_set_out=path/to/protoset.bin` and crucially, `--include_imports`. Ensure all `.proto` files, including any imported dependencies, are correctly passed to `protoc` in the compilation step.
Review your `protoc` command. Ensure `-I` flags point to the root directories where your `.proto` files reside without overlap, and avoid listing the same `.proto` file multiple times as input. Use a consistent directory structure for your protos.