Skip to content
Latchkey

grpcurl: Usage, Options & Common CI Errors

grpcurl calls gRPC methods from the command line, like curl for gRPC.

grpcurl is the standard way to smoke-test a gRPC endpoint in CI. The two recurring failures are server reflection not being enabled and forgetting -plaintext on a non-TLS port.

What it does

grpcurl invokes gRPC methods over the wire, listing and describing services via server reflection or local .proto files, and sends JSON request bodies that it marshals to protobuf. It is the gRPC equivalent of curl for scripted health checks.

Common usage

Terminal
grpcurl -plaintext localhost:50051 list          # list services
grpcurl -plaintext localhost:50051 describe my.Svc
grpcurl -plaintext -d '{"id":"1"}' localhost:50051 my.Svc/Get
grpcurl -import-path ./proto -proto my.proto -d '{}' host:443 my.Svc/Get
grpcurl host:443 grpc.health.v1.Health/Check     # standard health probe

Options

FlagWhat it does
-plaintextUse plaintext (no TLS) - required for non-TLS ports
-d <json>Request body as JSON (- reads from stdin)
-import-path / -protoResolve methods from local .proto files
-H "k: v"Add a request metadata header
-insecureUse TLS but skip certificate verification
list / describeEnumerate / introspect services and methods

Common errors in CI

Failed to dial target host ... server does not support the reflection API - the server has not registered grpc.reflection; supply the schema with -import-path/-proto instead, or enable reflection. "Failed to dial ... tls: first record does not look like a TLS handshake" means the port is plaintext - add -plaintext. "rpc error: code = Unimplemented" means the service/method name is wrong (it is package.Service/Method, case-sensitive). "code = Unavailable ... connection refused" means nothing is listening on that host:port yet.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →