Integrate application with LoRa App Server gRPC API issues

Hello,I want use grpc post data to deviceQueue,the following is my code:

the client log:
lp-> any error: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = "transport: authentication handshake failed: x509: cannot validate certificate for because it doesn’t contain any IP SANs

the server log(docker-compose logs -f appserver):
appserver_1 | 2018/05/15 08:43:37 http: TLS handshake error from remote error: tls: bad certificate

“” is my client pc’s ip.
“” is my server pc’s ip.
I think it should have something to do with HTTPS.

=========================code start===========================
package main

import (

const (
OpenTLS = true

type CustomCredential struct{}

func (c CustomCredential) GetRequestMetadata(ctx context.Context, uri …string) (map[string]string, error) {
return map[string]string{
“authorization”: “eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJsb3JhLWFwcC1zZXJ2ZXIiLCJhdWQiOiJsb3JhLWFwcC1zZXJ2ZXIiLCJuYmYiOjE1MTMwNzE1NjYsImV4cCI6MTU0MzE1Nzk2Niwic3ViIjoidXNlciIsInVzZXJuYW1lIjoiYWRtaW4ifQ.x7aMoKQiqndmU4xDI8SSPLffoeLTjDN4cWxudQQ85ZQ”,
}, nil

func (c CustomCredential) RequireTransportSecurity() bool {
return OpenTLS

func send2DeviceQueue() {

var opts []grpc.DialOption

if OpenTLS {
	creds, err := credentials.NewClientTLSFromFile("../certs/http.pem", "")
	if err != nil {
		log.Println("lp-> open tls--error:", err)
	opts = append(opts, grpc.WithTransportCredentials(creds))
} else {
	opts = append(opts, grpc.WithInsecure())

//opts = append(opts, grpc.WithPerRPCCredentials(new(CustomCredential)))

clientConn, err := grpc.Dial(RPC_SERVER_ADDRESS, opts...)
if err != nil {
	log.Fatal("lp-> grpc-conn-error:", err)

data := []byte{1, 2, 3, 4, 5, 6}

//defer clientConn.Close()

deviceQueueApi := api.NewDeviceQueueClient(clientConn)
r, err := deviceQueueApi.Enqueue(context.Background(), &api.EnqueueDeviceQueueItemRequest{
	DevEUI:    "0102030405060708",
	Reference: "abcdef",
	Confirmed: true,
	FPort:     6,
	Data:      data,
if err != nil {
	log.Fatalln("lp-> any error:", err)
log.Fatalln("lp-> result:", r)


func main() {
=========================code end============================

You could take a look at how the gRPC client between LoRa App Server and LoRa Server are implemented as an example :slight_smile: It works exactly the same, only against a different API (LoRa Server API instead of the LoRa App Server API).

Thanks,I have read it many times.Maybe you could tell me where my code might be wrong? I will read " lora-app-server/internal/nsclient/pool.go" again.:grinning: