gRPC Application Service Client stream error


am trying to communicate with grpc server with golang. After logging I include in metadata jwt token to authenticate to the server seems correctly but the line below got always with an error 13

app, err := api.NewApplicationServiceClient(grpcConn).Get(ctx, &api.GetApplicationRequest{

Id: 2,


Error msg:

rpc error: code = Internal desc = stream terminated by RST_STREAM with error code: PROTOCOL_ERROR

Also, in server side I get similar message:

http2: server connection error from connection error: PROTOCOL_ERROR

Do you know why login works fine while NewApllicationServiceClient not?

@brocaar have you already seen something similar?

I have not had this error myself yet. Given that you get a protocol error, are you sure your are not mixing TLS and non-TLS in your client and server?

Thanks for reply.

Actually, I saw in your auth.go server side that only “authorization” metadata is expected while I was trying from client with

"Grpc-Metadata-Authorization: Bearer" : JWT

Now it works with following metadata.

"Authorization" : JWT

Hello @ale16384,

I’m really interested by an example indeed as you can see from this link (, I’m trying to use grpc server with golang.

Thank you for your help.


Do you need an example to do what?

If you need to communicate with gRPC server with your client written in golang I suggest you to think about what you want to do with your client first then you can use the api list in the following page brocaar provided.

Hello, thank for your answer,

In fact to start I want to use client “Go func” related to DeviceQueueItem in order to handle the data.

But the starting point is to connect to grpc server, I’m looking for any example of how to connect to the grpc server from main.go script.

I found this example but I’m looking for another to compare them.

Do you read my link in previous reply, because I 'm not sure of my understanding about grpc method and how to use it ?
Thank you so much for your help.

gRPC server can be reached by using grpc.Dial method. Yes…

In my configuration I couldn’t use following option because external server api uses TLS authentication.


If you cannot connect to the server you should see this from lora-app-server log. Use following command to check it.

journalctl -u lora-app-server.service -n 100

I use to connect from client remotely using server TLS certificate file “http.pem”

func GRPCConn() *grpc.ClientConn {
creds, err := credentials.NewClientTLSFromFile("http.pem", "localhost")
asConn, err := grpc.Dial("", grpc.WithTransportCredentials(creds), grpc.WithTimeout(time.Millisecond*10000))
if err != nil {
return asConn


I hope this can help.

1 Like