Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not starting GRPC server #34

Open
hsenapati opened this issue Jun 28, 2019 · 5 comments
Open

Not starting GRPC server #34

hsenapati opened this issue Jun 28, 2019 · 5 comments

Comments

@hsenapati
Copy link

Description/Steps to reproduce

  1. Scaffolded a LB 4 app as "loopback4-example-express-composition"
  2. $ npm install --save @loopback/grpc
  3. Modified Index.ts file with the code explained in the section "Component Configuration" of https://www.npmjs.com/package/@loopback/grpc
  4. Followed the rest of the steps as mentioned in npm module "@loopback/grpc"

Link to reproduction sandbox

Expected result

  1. Suppose to generate "greeter.proto.ts", but it never generate the .tc file for the proto file.
  2. Copied the greeter.proto.ts file from "loopback4-extension-grpc/fixtures/greeter.proto.ts" to my above application.
  3. When I run "$npm start", it does not throw any error but the command prompt returns and server is not listening to any specific port.

Additional information

  1. How can I make the client application to call this server?
  2. How can I extend this to make grpc stream calls between client and server on loopback 4.
@dhmlau
Copy link
Member

dhmlau commented Jun 28, 2019

@raymondfeng , could you please take a look? Thanks.

@raymondfeng
Copy link
Contributor

@hsenapati Can you try @loopback/[email protected]?

@hsenapati
Copy link
Author

@raymondfeng The path I mentioned with the issue "https://www.npmjs.com/package/@loopback/grpc" is for 0.1.1 revision, I suppose. Can you help providing sample code. Thanks

@raymondfeng
Copy link
Contributor

I just released @loopback/[email protected] 15 mins ago. Please upgrade your app to this version and try again.

@hsenapati
Copy link
Author

Thanks @raymondfeng for the details.

The grpc npm package works for Hello World on linux, but following changes were done to make the Hello World work on Windows 64 bit.

  1. Changed code block for “Component.Configuration” part from “const config: Config.Component” to “const config: object”
  2. Grpc compiler for LB4 is not installed as part of grpc npm module. So manually copied compiler to “node_modules@loopback\grpc”
  3. Controller code should not refer the .proto file till the proto.ts is generated by the compiler.
  4. We had to install “npm install ts-protoc-gen@next” as opposed to “npm install ts-protoc-gen” to make the grpc compiler generate the compiled protos file.
  5. Updated the compiler command file from “protoc-gen-ts” to “protoc-gen-ts.cmd” in the “node_modules@loopback\grpc\dist\grpc.generator.js” for the compiler to work.
  6. It does not generate proto.ts file with interfaces which is required for grpc server to instantiate. But it compiles to following 3 files for a single greeter.proto file
    a. greeter_pb_service.d.ts
    b. greeter_pb_service.js
    c. greeter_pb.d.ts
  7. So manually had to copy the proto.ts file from the linux machine which had the required interfaces.
  8. Now, LB4 + gRPC Server started.
  9. Now for client, used NodeJS grpc client (non-LB4 client) as her "https://grpc.io/docs/quickstart/node/" to send a simple message to server. This worked.

Following are the open challenges

  1. Can you update the grpc npm module of LB4 to make the above fixes for windows 64 bit.
  2. No sample code available to work for grpc client, streaming call (bidirectional) and authentication etc. So can you provide or point up code references for us to try out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants