0

I am having a really difficult time communicating with a gRPC Server that I deployed on Herkou.

Here is how I am listening on the gRPC Server with NodeJS:

server.js

init() {
    let grpcServer = new grpc.Server();
    grpcServer.addService(services.LocationManagementService, LocationManager);
    grpcServer.bindAsync('0.0.0.0:50051', grpc.ServerCredentials.createInsecure(), () => {
        grpcServer.start();
        console.log("GRPC Server Started");
    });
}

Where LocationManager.js is as below

const LocationManager = {
    updateLocation: (call, callback) => {
        console.log("The Location Update Function Has Being called");
        let locationUpdateResponse = new messages.LocationDataResponse();
        let request = call.request;
        let authParams = request.getAuthParams();
        let locationUpdateTarget = request.getLocationUpdateTarget();
    },
    queryLocation: (call, callback) => {
        let locationQueryResponse = new messages.LocationDataResponse();
    }
}
module.exports = LocationManager;

Generated the Client Libraries for Flutter and Used as below:

static ClientChannel clientChannel() {
    return ClientChannel(
      myappname.herokuapp.com,
      port:50051,
      options: ChannelOptions(
        credentials: ChannelCredentials.insecure(),
      ),
    );
  }

LocationManagementClient locationManagementClient =
          LocationManagementClient(clientChannel());

But all I keep getting is:

gRPC Error (code: 14, codeName: UNAVAILABLE, message: Error connecting: SocketException: OS Error: Connection timed out, errno = 110, address = myappname.herokuapp.com, port = 32788, details: null, rawResponse: null)

Any insights would be greatly appreciated.

Thank you.

ololo
  • 1,326
  • 2
  • 14
  • 47
  • You posted [another question](https://stackoverflow.com/questions/67357854/avoiding-port-conflicts-in-grpc-server) about running a gRPC server on Heroku, and it was mentioned in the comments on the answer that you should point your client at port 80 to connect through Heroku's frontend proxy. I suggest doing that. – murgatroid99 May 06 '21 at 17:13
  • Hello @murgatroid99 Yea, I tried pointing to 80 but yet I still can't connect. This is really weird and frustrating, what could be wrong? Note, that I am using the Client Libraries I generated via the gRPC command for Dart. I still keep getting ```Error connecting: SocketException: OS Error: Connection timed out, errno = 110, address = appname.herokuapp.com``` from my Flutter Client. – ololo May 06 '21 at 18:52
  • Or could it be because Heroku doesn't support HTTP/2 yet? I'm realy confused, can't believe I'm stuck on this instead of moving forward with my app. – ololo May 06 '21 at 18:53
  • [Heroku doesn't support HTTP/2](https://devcenter.heroku.com/articles/http-routing#http-versions-supported) – murgatroid99 May 06 '21 at 18:55
  • @murgatroid99 Is that the Reason? So where do you suggest I deploy my gRPC Server to? – ololo May 06 '21 at 18:56
  • Yes, Heroku not supporting HTTP/2 is probably the reason that you can't connect to a server on Heroku using a protocol that uses HTTP/2. As for where else you can deploy, I don't know. I suggest doing some research. – murgatroid99 May 06 '21 at 18:57

0 Answers0