njpatel / grpcc Goto Github PK
View Code? Open in Web Editor NEWA gRPC cli interface for easy testing against gRPC servers
License: Other
A gRPC cli interface for easy testing against gRPC servers
License: Other
Tried running against a .proto
file without a package declaration and grpcc couldn't locate any services inside.
While executing the basic gprcc command on Mac OS Sierra:
grpcc --proto <file> --address 127.0.0.1:<port>
I'm getting the following errors
TypeError: Cannot read property 'ns' of null
at Object.load (/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/node/index.js:152:28)
at createClient (/usr/local/lib/node_modules/grpcc/lib/index.js:16:21)
at Object.<anonymous> (/usr/local/lib/node_modules/grpcc/bin/grpcc.js:30:3)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
Update:
This only happens when the 'file' path is absolute.
When using a relative path, like the following command, I get an other error. This seems because of an import statement of an other proto file in the referenced file. The import statement is relative by itself, but it uses the base-path from where you run the gprcc-command, instead of the base-path of the file where the import statement occurs
Error: failed to import '/Users/andries/projects/google/protobuf/timestamp.proto' in './node_modules/fabric-client/lib/protos/peer/chaincode.proto': file not found
at Error (native)
at Builder.ProtoBuf.Builder.BuilderPrototype.import (/usr/local/lib/node_modules/grpcc/node_modules/protobufjs/dist/protobuf.js:4720:35)
at Object.ProtoBuf.loadJson (/usr/local/lib/node_modules/grpcc/node_modules/protobufjs/dist/protobuf.js:5225:26)
at Object.ProtoBuf.loadProto (/usr/local/lib/node_modules/grpcc/node_modules/protobufjs/dist/protobuf.js:5128:25)
at Object.ProtoBuf.loadProtoFile (/usr/local/lib/node_modules/grpcc/node_modules/protobufjs/dist/protobuf.js:5174:52)
at Object.load (/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/node/index.js:141:26)
at createClient (/usr/local/lib/node_modules/grpcc/lib/index.js:16:21)
at Object.<anonymous> (/usr/local/lib/node_modules/grpcc/bin/grpcc.js:30:3)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
The import statement in the supplied proto-file is
import "../google/protobuf/timestamp.proto";
The simple work-around is to navigate to the directory where the proto-file is, and executing:
grpcc --proto ./chaincode.proto --address 127.0.0.1:7051
I guess it is possible to fix?
Tried to install. Said it needed node-pre-gyp. Installed it and it still didn't work
[TypeError: Cannot read property 'ns' of null]
Hi,
I;m getting the following error message while starting grpcc :
> xx@dvlp2:~$ grpcc
> /usr/bin/env: ‘node --harmony’: No such file or directory
> xx@dvlp2:~$ node -v
> v6.9.1
Thank you.
Cheers,
jj
grpcc --proto ./Users/pavankumar/Downloads/synchronicity.proto --address tingle-grpc.synchronicity.ai:443
Error: Could not load file "[object Object]"
at Object.load (/Users/pavankumar/.npm-global/lib/node_modules/grpcc/node_modules/grpc/index.js:149:11)
at Object.deprecated [as load] (internal/util.js:70:15)
at createClient (/Users/pavankumar/.npm-global/lib/node_modules/grpcc/lib/index.js:57:21)
at Object. (/Users/pavankumar/.npm-global/lib/node_modules/grpcc/bin/grpcc.js:35:3)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:719:10)
{ Error: 14 UNAVAILABLE: Connect Failed
at new createStatusError (C:\Users\satish.sharma\AppData\Roaming\npm\node_modules\grpcc\node_modules\grpc\src\client.js:64:15)
at C:\Users\satish.sharma\AppData\Roaming\npm\node_modules\grpcc\node_modules\grpc\src\client.js:583:15 code: 14, metadata: {}, details: 'Connect Failed' }
I've got a protobuf
file with a single service. When running with v1.1.0 I get the expected behaviour, but with v1.1.1 there seems to have been a regression, as I get an Unable to find any service in proto file
error message when running grpcc -p ./my-proto-file.proto -a 127.0.0.1:3456
.
At first glance, maybe this line needs to be updated to have the second argument?
If enum is outside a message (top-level), grpcc picks up on the enum and considers it a package name, rendering the tool unusable.
e.g.
package grpcctest;
enum EventType {
TEST = 0;
TEST_AGAIN = 1;
}
What package you want to use? (Use arrow keys)
❯ grpcctest.EventType.TEST
grpcctest.EventType.TEST_AGAIN
Expected:
What package you want to use? (Use arrow keys)
❯ grpcctest
/usr/local/lib/node_modules/grpcc/node_modules/bindings/bindings.js:83
throw e
^
Error: Module did not self-register.
at Error (native)
at Object.Module._extensions..node (module.js:440:18)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at bindings (/usr/local/lib/node_modules/grpcc/node_modules/bindings/bindings.js:76:44)
at Object. (/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/node/src/client.js:54:31)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
I tried and failed to find how to perform gRPC call in non-interactive mode. Is it possible?
Btw, interactive mode is gorgeous! Thanks 👍
This is for cases where the GRPC server only accepts certificate signed by a defined CA.
When using dot-delimited packages (as is usual in the java world) e.g. "com.foo.package", grpcc only offers the first path component as an option:
grpcc --proto My.proto --directory path/to/proto/ --address localhost:8091 -i
? What package you want to use? com
(node:17275) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Unable to locate service undefined in My.proto
Hi,
There is a display bug with the oneof
fields. Even if one of the values is set, it always displays null
.
Example :
message Message1 {
string name = 1;
oneof example {
Type1 value1 = 8;
Type2 value2 = 9;
}
}
Output :
{
"name": "Dexter",
"example": null
}
My project's proto has tons of import, packages without any rpc service . This helps a lot.
Can be easily change in https://github.com/njpatel/grpcc/blob/master/lib/index.js#L23
From:
let packages = Object.keys(JSON.parse(JSON.stringify(parsed)));
To
let packages = Object.keys(parsed).filter((pkn) => Object.keys(parsed[pkn]).some((spkn) => parsed[pkn][spkn].name === 'ServiceClient'))
https://github.com/njpatel/grpcc/blob/master/lib/index.js#L27
inquirer.prompt([{
type: 'list',
name: 'packageName',
message: 'What package you want to use?',
choices: packages
}])
I've tried completely deleting everything associated with node and I can not get grpcc to install through rpm at all.
npm version is 3.5.2
node version is 4.2.6
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "grpcc"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! path /usr/local/lib/node_modules/.staging/node-pre-gyp-788c79f0
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/node-pre-gyp-788c79f0' -> '/usr/local/lib/node_modules/grpcc/node_modules/grpc/node_modules/node-pre-gyp'
npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/node-pre-gyp-788c79f0' -> '/usr/local/lib/node_modules/grpcc/node_modules/grpc/node_modules/node-pre-gyp'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! Please include the following file with any support request:
npm ERR! /root/npm-debug.log
Why it can't find google/protobuf
package?
syntax = "proto3";
package eventstream;
import "google/protobuf/struct.proto";
eventstream/google/protobuf/struct.proto' in './vendor/proto/eventstream/rpc.proto': file not found
Cool tool! I can definitely see this being handy for testing some of my endpoints!
I'm getting this error; and unfortunately don't have the context to debug it myself,
[email protected]:50051> client.getKeywords({}, pr)
TypeError: Cannot read property 'name' of null
at __ (/usr/local/lib/node_modules/grpcc/node_modules/arguejs/argue.js:117:46)
at Client.makeServerStreamRequest [as getKeywords] (/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/node/src/client.js:559:16)
at repl:1:8
at ContextifyScript.Script.runInContext (vm.js:32:29)
at REPLServer.defaultEval (repl.js:341:29)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.onLine (repl.js:536:10)
at emitOne (events.js:96:13)
at REPLServer.emit (events.js:191:7)
This is in response to running getKeywords, which is implemented agains this proto;
service Keywords {
rpc GetKeywords (KeywordQuery) returns (stream KeywordInfo) {}
}
message KeywordQuery {
repeated string search_term = 1;
repeated string taxonomies = 2;
repeated string must_contain = 3;
bool allow_nsfw = 4;
string language = 5;
}
A basic "hello world" grpc worked fine, any ideas why this doesn't work?
My grpc server responds correctly to my java client so I'm confident the server is working.
Hello,
The way we use grpc we require more than one .proto file. Would it be interesting to be able to use more than one proto file?
Hey,
Just had a confusing moment with the tool. Basically, the tool seems to fail when loading packages from deeper path levels than the first one. Something like package example;
works and the tool correctly finds the definitions. If I have something like package com.example.v1;
, the tool will not find the definitions and exits silently with no error message.
The error happens choices: Object.keys(parsed)
as it is currently not traversing the hierarchy stored in let parsed = grpc.load(file);
but instead just lists the top level packages
For test auth protected apis in server side, could request header customization feature be added? Or, do we already have this function? Didn't see docs about this feature.
this is not how you use eval?
aep@u8: grpcc --proto proto/0x.proto --insecure --address 127.0.0.1:8080 --eval 'client.getIdentity({}, pr)'
TypeError [ERR_INVALID_ARG_TYPE]: The "options.filename" property must be of type string. Received type object
at new Script (vm.js:57:13)
at module.exports (/home/aep/.nvm/versions/node/v10.0.0/lib/node_modules/grpcc/node_modules/eval/eval.js:68:18)
at init (/home/aep/.nvm/versions/node/v10.0.0/lib/node_modules/grpcc/lib/index.js:152:5)
at prepareClient (/home/aep/.nvm/versions/node/v10.0.0/lib/node_modules/grpcc/lib/index.js:44:3)
at createClient (/home/aep/.nvm/versions/node/v10.0.0/lib/node_modules/grpcc/lib/index.js:82:12)
at Object.<anonymous> (/home/aep/.nvm/versions/node/v10.0.0/lib/node_modules/grpcc/bin/grpcc.js:35:3)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
the same works fine with interactive mode
grpcc --proto proto/0x.proto --insecure --address 127.0.0.1:8080
Connecting to zeroxproto.v1.Bearer on 127.0.0.1:8080. Available globals:
client - the client connection to Bearer
getIdentity (Empty, callback) returns IdentityReply
printReply - function to easily print a unary call reply (alias: pr)
streamReply - function to easily print stream call replies (alias: sr)
createMetadata - convert JS objects into grpc metadata instances (alias: cm)
printMetadata - function to easily print a unary call's metadata (alias: pm)
[email protected]:8080> client.getIdentity({}, pr)
EventEmitter {}
[email protected]:8080> (node:32638) [DEP0079] DeprecationWarning: Custom inspection function on Objects via .inspect() is deprecated
{
"hostname": "none",
"version": 1,
"head": ""
}
I've installed grpcc successfully
sudo npm install -g grpcc
/usr/local/bin/grpcc -> /usr/local/lib/node_modules/grpcc/bin/grpcc.js
+ [email protected]
updated 1 package in 4.057s
grpcc -v
->
Error: The gRPC binary module was not installed. This may be fixed by running "npm rebuild"
Original error: Cannot find module '/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/node/extension_binary/node-v57-darwin-x64-unknown/grpc_node.node'
at Object.<anonymous> (/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/grpc_extension.js:43:17)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/client_interceptors.js:145:12)
at Module._compile (module.js:652:30)
Example:
Error: Parse error at line 136: illegal option name: (google.api.http).,
at Error (native)
at Parser.ProtoBuf.DotProto.ParserPrototype._parseOptionValue (/usr/local/lib/node_modules/grpcc/node_modules/protobufjs/dist/ProtoBuf.js:965:31)
at Parser.ProtoBuf.DotProto.ParserPrototype._parseOption (/usr/local/lib/node_modules/grpcc/node_modules/protobufjs/dist/ProtoBuf.js:929:18)
at Parser.ProtoBuf.DotProto.ParserPrototype._parseServiceRPC (/usr/local/lib/node_modules/grpcc/node_modules/protobufjs/dist/ProtoBuf.js:1046:30)
at Parser.ProtoBuf.DotProto.ParserPrototype._parseService (/usr/local/lib/node_modules/grpcc/node_modules/protobufjs/dist/ProtoBuf.js:994:26)
at Parser.ProtoBuf.DotProto.ParserPrototype.parse (/usr/local/lib/node_modules/grpcc/node_modules/protobufjs/dist/ProtoBuf.js:771:34)
at Function.ProtoBuf.DotProto.Parser.parse (/usr/local/lib/node_modules/grpcc/node_modules/protobufjs/dist/ProtoBuf.js:795:39)
New MacBook 2018 running most recently patched everything, error when installing:
$ sudo npm install -g grpcc
/usr/local/bin/grpcc -> /usr/local/lib/node_modules/grpcc/bin/grpcc.js
[email protected] install /usr/local/lib/node_modules/grpcc/node_modules/grpc
node-pre-gyp install --fallback-to-build --library=static_library
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v57 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/node'
gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/gregoryperry/.node-gyp/8.11.4"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/grpcc/node_modules/grpc/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/grpcc/node_modules/grpc/.node-gyp'
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/node/extension_binary/node-v57-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/node/extension_binary/node-v57-darwin-x64-unknown" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /usr/local/lib/node_modules/grpcc/node_modules/grpc
gyp ERR! node -v v8.11.4
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/node/extension_binary/node-v57-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/node/extension_binary/node-v57-darwin-x64-unknown --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess. (/usr/local/lib/node_modules/grpcc/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:925:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Darwin 17.7.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/grpcc/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/grpcc/node_modules/grpc
node-pre-gyp ERR! node -v v8.11.4
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/node/extension_binary/node-v57-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/node/extension_binary/node-v57-darwin-x64-unknown --napi_version=3 --node_abi_napi=napi' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build --library=static_library
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/gregoryperry/.npm/_logs/2018-10-02T18_20_30_024Z-debug.log
The protobuf "well-known types" (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf) are included in every language runtime, including the npm package (see protocolbuffers/protobuf#1638).
Currently, grpcc requires proto files that import a well-known type to have a copy of the well-known type locally, otherwise you get an Error: failed to import '...' in './foo.proto': file not found
error.
These well-known types should be handled automatically by importing them from the protobuf npm package instead.
Hi,
$ grpcc --proto ./some.proto --address someaddresss
module.js:328
throw err;
^
Error: Cannot find module '/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/node/extension_binary/grpc_node.node'
at Function.Module._resolveFilename (module.js:326:15)
at Function.Module._load (module.js:277:25)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/node/src/grpc_extension.js:38:15)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
I am new to gRPC but using this tool how do you provide a client id and secret with the endpoint address?
Whenever I add an import to the proto file, grpcc can't find any service.
e.g. import "google/protobuf/field_mask.proto";
I haven't tested or debugged it any further but my guess is that it only checks the imported proto definition as it doesn't have any services in it.
I've added an enum at the root of the package of a proto file and the grpc options for packages shows as follows:
https://puu.sh/xyr8B/806119c65a.png
If you wrap the enum in a message, it resolves the problem and shows the proper package for the API.
https://puu.sh/xyr9N/3c5858b4df.png
Please support the following example proto file to ensure that you can find a package even with enum at the root
`
package kintohub.authblock.generated;
service AuthBlock {
rpc Login(LoginRequest) returns (LoginResponse) {
option (google.api.http) = {
post: "/auth/login"
body: "*"
};
}
rpc Register(CreateRequest) returns (CreateResponse) {
option (google.api.http) = {
post: "/auth/register"
body: "*"
};
}
rpc ValidateEmail(ValidateEmailRequest) returns (ValidateEmailResponse) {
option (google.api.http).get = "/auth/validate";
}
// rpc ForgotPassword(ForgotPasswordRequest) returns (ForgotPasswordResponse) {
// option (google.api.http) = {
// post: "/auth/forgotpassword"
// body: "*"
// };
// }
//
// rpc ResetPassword(ResetPasswordRequest) returns (ResetPasswordResponse) {
// option (google.api.http) = {
// post: "/auth/resetpassword"
// body: "*"
// };
// }
}
message SessionData {
enum SessionRole {
GUEST = 0;
AUTHED_USER = 1;
};
}
`
Environment: Windows 10 64bit, grpcc version 0.0.8, Protobuf 3.4.0, GRPC 1.4.0
Firstly thanks for putting this tool out.
I am having issues sending GRPC requests where the input is a message with more than one fields. Can you please provide examples for such cases ares.
MyCli@unix:/tmp/my_socket> client.createRequest({name: "Hello", input: 2, output: 4}, printReply)
EventEmitter {}
MyCli@unix:/tmp/my_socket> Error: { [Error] code: 12, metadata: Metadata { _internal_repr: {} } }
I tried other json style combinations and I keep getting more basic errors, hence the request..
Thanks!!
Send non-proto rpc
For using gRPC with protocols other than protobuf, you will need the exact method name string and a file containing the raw bytes to be sent on the wire.
$ grpc_cli call localhost:50051 /helloworld.Greeter/SayHello \
--input_binary_file=input.bin \
--output_binary_file=output.bin
On success, you will need to read or decode the response from the output.bin file.
https://github.com/grpc/grpc/blob/master/doc/command_line_tool.md
Your tool can't do this, right?
Unfortunately env
in Linux doesn't support arguments, so executing grpcc
fails immediately. Omitting
See discussion in SpencerCDixon/redux-cli#42 on possible solutions. grpcc seems to work well with the stable Node even without the --harmony
flag.
I wish to provide the "default authority" ChannelOption when connecting to the service. Right now there does not seem to be a possibility to do this.
I need to pass a proto map via grpcc. My .proto file is like this:
message AttemptFriendshipRequest {
//other params
map<string, string> params = 2;
}
How should the json input body be?
I tried following but didn't work:
{.... , params: {"lastName":"demoUserLName"}}
{.... , params:[ {"lastName":"demoUserLName"}]}
Please provide a streaming example through command line interactive mode. Something like the following:
var call=client.getSomething({id_list=["1","2","3"]});call.on('data', function(feature){console.log(feature)});
On Windows.. If we try to use google's timestamp.proto, we have to copy the google directory from the contents of C:\Users\USER_NAME.nuget\packages\google.protobuf.tools\3.2.0\tools\ into the C:\Path\To\Proto directory containing MyFile.proto
That .proto file has an import like so:
import "google/protobuf/timestamp.proto";
That's a problem b/c although there's a workaround to copy the google directory over we have to tell git to ignore it so it isn't checked in, and protobuf.tools may be updated at a later date, meaning manually updating that directory, just for testing with grpcc.
Here is the command line I tried (and many similar variants):
C:\Path\To\Proto>grpcc --proto ./MyFile.proto --address 127.0.0.1:12345 -i -d "C:\Users\USER_NAME.nuget\packages\google.protobuf.tools\3.2.0\tools"
TypeError: Cannot read property 'ns' of null
at Object.load (C:\Users\USER_NAME\AppData\Roaming\npm\node_modules\grpcc\node_modules\grpc\src\node\index.js:152:28)
at createClient (C:\Users\USER_NAME\AppData\Roaming\npm\node_modules\grpcc\lib\index.js:16:21)
at Object. (C:\Users\USER_NAME\AppData\Roaming\npm\node_modules\grpcc\bin\grpcc.js:30:3)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:390:7)
As mentioned, simply copying "google" over to C:\Path\To\Proto worked fine.
I have a problem with empty error:
I call:
client.getAllMetadata({}, pr)
and I recevied empty error:
Error: { Error
at C:\user\AppData\Roaming\npm\node_modules\grpcc\node_modules\grpc\src\node\src\client.js:554:15 code: 12, metadata: Metadata { _internal_repr: {} } }
Is the error from gRPC endpoint or grpcc tool? Thank you.
This issue is the flip side of #33; when I receive metadata, I expect something like:
{"x-request-id": "1234", "x-error-id": "0xdeadbeef"}
, but I get { 'x-error-id': [Array], 'x-request-id': [Array] }
as the _internal_repr
.
(This is using .on('metadata', pr)
.)
16:51 $ node --harmony /usr/bin/grpcc
/usr/lib/node_modules/grpcc/lib/index.js:4
require('events').prototype.inspect = () => {return 'EventEmitter {}';};
^
SyntaxError: Unexpected token )
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/lib/node_modules/grpcc/bin/grpcc.js:7:13)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
Also, this won't run at all in Ubuntu: http://unix.stackexchange.com/questions/63979/shebang-line-with-usr-bin-env-command-argument-fails-on-linux
Above on ubuntu 14.04 and node 0.10.25
I tried it on OSX with node 0.10.18 and got the same thing.
Hello tried to use the util:
⇒ grpcc -p ab.proto -a 35.204.122.102:7050
Error: Could not load file "[object Object]"
at Object.load (/Users/allexx/.nvm/versions/node/v8.9.1/lib/node_modules/grpcc/node_modules/grpc/index.js:149:11)
at Object.deprecated [as load] (internal/util.js:52:15)
at createClient (/Users/allexx/.nvm/versions/node/v8.9.1/lib/node_modules/grpcc/lib/index.js:57:21)
at Object.<anonymous> (/Users/allexx/.nvm/versions/node/v8.9.1/lib/node_modules/grpcc/bin/grpcc.js:35:3)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
syntax = "proto3";
import "hfc/protos/common/common.proto";
option go_package = "github.com/hyperledger/fabric/protos/orderer";
option java_package = "org.hyperledger.fabric.protos.orderer";
package orderer;
message BroadcastResponse {
common.Status status = 1;
}
message SeekNewest { }
message SeekOldest { }
message SeekSpecified {
uint64 number = 1;
}
message SeekPosition {
oneof Type {
SeekNewest newest = 1;
SeekOldest oldest = 2;
SeekSpecified specified = 3;
}
}
message SeekInfo {
enum SeekBehavior {
BLOCK_UNTIL_READY = 0;
FAIL_IF_NOT_READY = 1;
}
SeekPosition start = 1; // The position to start the deliver from
SeekPosition stop = 2; // The position to stop the deliver
SeekBehavior behavior = 3; // The behavior when a missing block is encountered
}
message DeliverResponse {
oneof Type {
common.Status status = 1;
common.Block block = 2;
}
}
service AtomicBroadcast {
// broadcast receives a reply of Acknowledgement for each common.Envelope in order, indicating success or type of failure
rpc Broadcast(stream common.Envelope) returns (stream BroadcastResponse) {}
// deliver first requires an Envelope of type DELIVER_SEEK_INFO with Payload data as a mashaled SeekInfo message, then a stream of block replies is received.
rpc Deliver(stream common.Envelope) returns (stream DeliverResponse) {}
}
Often times, .proto files will depend on .proto file that aren't in the same directory (they may be on a system include path or pulled in as part of a dependency).
Would it be possible to have a command line option that specifies a search path for included .protos (similar to protoc
)?
@louiscryan: @njpatel @grpcio Very cool! You might want to take a look at https://t.co/vQLFqrcxBs and support that at some point
https://github.com/grpc/grpc/blob/master/doc/server-reflection.md
I'm getting this error when connecting to a grpc service.
Versions:
I tried to run grpcc
using simple .proto file :
But after hitting Enter the error message mentioned in the title appeared :
Even using the .proto file mentioned in grpcc
example yielded the same error for me.
What can possibly be the cause and how to fix it? Anybody else, probably in a different environment (OS, version of npm
and node
), experiencing this error?
I can reproduce the error on Windows 10, using the following version of node
& npm
:
λ node -v
v6.10.2
λ npm -v
3.10.10
as well as on Ubuntu 16.10, using higher version of node
& npm
:
$ node -v
v7.9.0
$ npm -v
4.2.0
$ npm install -g grpcc
/usr/local/bin/grpcc -> /usr/local/lib/node_modules/grpcc/bin/grpcc.js
[email protected] install /usr/local/lib/node_modules/grpcc/node_modules/grpc
node-pre-gyp install --fallback-to-build --library=static_library
[grpc] Success: "/usr/local/lib/node_modules/grpcc/node_modules/grpc/src/node/extension_binary/node-v48-darwin-x64-unknown/grpc_node.node" is installed via remote
I'm wondering how I can add metadata? I'm trying to add an authentication method to my gRPC service and testing with grpcc will be useful. So hopefully there's a way?
This is a Feature Request than a bug or issue
I found this https://www.npmjs.com/package/protobuf-jsonschema which can provide json schema of proto messages,
It would be great if we can embed it into the CLI, so that we can know how to construct the Request Response objects and may be validate them before actually making the API call.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.