grpc-gateway-generator icon indicating copy to clipboard operation
grpc-gateway-generator copied to clipboard

Help wanted. connect to backends fails.

Open fjoesne opened this issue 7 years ago • 2 comments

I have a nodejs backend grpc-server (condor) that is up and running, but it seems the grpc-gateway is unable to establish connection to the backend(s). There are no information whatsoever about what goes wrong.

You can look at the configurations etc, but it would be sufficient if I can get some help making the gateway server more verbose for debugging as I have very limited go-experience.

PS I've forked docker-grpc-gateway to make it useable in our workflow. There may be some obvious mistakes made by the config-generator script, but as far as I can see the config file generated is ok. Also manually creating the config files makes no difference.

config generated / used

{
  "gateway": {
    "listen": ":8081"
  },
  "backends": [{
    "package": "info",
    "backend": "localhost:5100",
    "services": {
      "InfoService": "/info/"
    }
  }]
}

protofile: protos/info/informer.proto

syntax = "proto3";

package info;

import "google/api/annotations.proto";
////
//// Service definition
////
service InfoService {

    // setinfo adds a Info item to the database.
    rpc SetInfo (AddInfoRequest) returns (Confirmation){
        option (google.api.http) = {
            put: "/info/setinfo/{info.uuid}"
            body: "auth"
        };
    }

    // getInfo retrieves a Info item from database based on uuid.
    rpc GetInfo (GetInfoRequest) returns (InfoResponse){
        option (google.api.http) = {
            post: "/info/getinfo/{uuid}"
            body: ""
        };
    }

    // listCategories retrieves list of all categories available in database
    rpc ListCategories (CategoryListRequest) returns (CategoryList){
        option (google.api.http) = {
            post: "/info/listcategories"
            body: ""
        };
    }

    // listHeader retrieves list of all info headers in database, with uuid.
    rpc ListHeaders (HeaderListRequest) returns (HeaderList){
        option (google.api.http) = {
            post: "/info/listheaders"
            body: ""
        };
    }

}

////
//// Message definitions
////

// SetInfo messages

message AddInfoRequest{
    Info info = 1;
    Auth auth = 2;
//    Timestamp timestamp = 3;
}

message Confirmation {
    string type = 1;
    string comment = 2;
    string error = 3;
//    Timestamp timestamp = 5;
}

// GetInfo messages

message GetInfoRequest{
    string uuid = 1;
    Auth auth = 2;
}

message InfoResponse{
    Info info = 1;
    string error = 2;
}

// ListCategories messages

message CategoryListRequest{
    Auth auth = 2;
}

message CategoryList{
    repeated string categories = 1;
    string error = 2 ;
}

// listHeaders messages

message HeaderListRequest{
    repeated string categories = 1;
    Auth auth = 2;
}

message HeaderList{
    repeated UuidAndHeader headers = 1;
    string error = 2;
}

message UuidAndHeader{
    string uuid = 1;
    string header = 2;
}

// global messages

message Info {
    string uuid = 1;
    string category = 2;
    repeated string subcategories = 3;
    string header = 4;
    string summary = 5;
    string body = 6;
    string author = 7;
}

message Auth{
    string user = 1;
    string password = 2;
    string token = 3;
}

fjoesne avatar Jul 20 '17 13:07 fjoesne

Hi. There are some issues with the script that I haven't had time to work into,... not sure if they are related to the problem you are having. Just quickly looking, I would say that verify that you can connect to the backend from a regular client directly, for instance, I see you are connecting to 5100 port, while the default GRPC port is 50051. (If you are using that port is ok, I just want to make sure that it's not just a typo)....

Sorry not to provide more help now. I expect to have 2 busy months, but after that I expect to get some free time to work on improving the script. Thanks!

c3s4r avatar Jul 20 '17 14:07 c3s4r

No problem, I'll try to find a solution and update here if i find it :)

I'm using 5100 in this case yes, the server is available for grpc-clients on this port.

Thanks again!

fjoesne avatar Jul 20 '17 15:07 fjoesne