fullstorydev / grpcurl

Like cURL, but for gRPC: Command-line tool for interacting with gRPC servers
MIT License
10.36k stars 497 forks source link

Failed to process proto source files #364

Open sqqqrly opened 1 year ago

sqqqrly commented 1 year ago

When I run this, I get an error:

# ls /root/csi.proto
/root/csi.proto
# pwd
/root

# grpcurl -plaintext -unix=true -proto /root/csi.proto /var/run/csi/csi.sock describe
Failed to process proto source files.: must specify at least one import path if any absolute file paths are given

However, this works. csi.proto is in my CWD:

# pwd
/root

# grpcurl -plaintext -unix=true -proto csi.proto /var/run/csi/csi.sock list
csi.v1.Controller
csi.v1.Identity
csi.v1.Node
jhump commented 1 year ago

Apologies if the error is unclear. Since you used an absolute path (/root/csi.proto), you must add an import path to the command line. File paths are not allowed to be absolute in Protobuf; they must instead be relative to some import path. When you specify a relative path (like the second example), the current directory is the assumed import path. But when you specify an absolute path, you must also tell it the import path, so it can compute the relative path for the file to compile. So adding -import_path /root to the first example would make it happy.

styshoo commented 1 week ago

import_path /root

Thanks a lot, but it should be import-path /root. Thanks again.