question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How do I make GRPC service calls in node

See original GitHub issue

Using improbable-eng/grpc-web 0.8.0

I’m trying to make a GRPC service call in a node environment (doing server side rendering), but I get an error when executing the request from this library. I saw that Node environments are supported and I have verified that my tsconfig has the dom lib included.

When i make a request in node, i get this error: This environment's XHR implementation cannot support binary transfer.

It looks like the browser support checks (https://github.com/improbable-eng/grpc-web/blob/master/client/grpc-web/src/transports/http/xhr.ts#L13-L17) are assuming a browser environment.

Any tips on how to get this working in node?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

3reactions
hmillisoncommented, May 13, 2019

you need to set the transport to NodeHttpTransport, why is that line commented out?

When instantiating the Service.RequestClient, you can pass in an options object to configure the transport of the GRPC service.

this is how my code looks:

new Service.RequestClient("http://localhost:5001", {
  transport: NodeHttpTransport()
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

Basics tutorial | Node - gRPC
Create a Server constructor from the RouteGuide service descriptor. Implement the service methods. Create an instance of the server by calling ...
Read more >
gRPC service in Node.js: Tutorial, Examples and Best practices
gRPC is an open-source remote procedure call(RPC) framework created by Google. It is an inter-process communication technology based on HTTP/2, ...
Read more >
Tutorial: How to Build Your First Node.js gRPC API - Trend Micro
To create a gRPC object, call the grpc-js method, loadPackageDefinition while passing in the previously created package definition. Use the ...
Read more >
Tutorial on How to Implement gRPC Services in NodeJS
Initialize Node environment · Install gRPC server · Define the StudentService in proto · Create Client stub · getAll Method: Get all Students....
Read more >
How to Create an API Using gRPC and Node.js
To create the server, open up the server.js file and load up the gRPC dependencies and the .proto file created earlier: //dependencies const ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found