Fabric sdk go app can't connect to orderer on SaveChannel

278 Views Asked by At

I'm trying to deploy my app in fabric sdk go for my hyperledger fabric network, but i have the following error when using the SaveChannel function: "Unable to initialize the Fabric SDK: failed to save channel: create channel failed: SendEnvelope failed: calling orderer 'localhost:7050' failed: Orderer Client Status Code: (2) CONNECTION_FAILED. Description: dialing connection timed out [localhost:7050]"

When i check the orderer container with docker logs i have the following information: "grpc: Server.Serve failed to complete security handshake from "ipnumber:port": remote error: tls: bad certificate" (i didn't put the original ip and port on the post). I have tried with TLS disable in containers, but it didn't work, sending the error "transport: http2Server.HandleStreams received bogus greeting from client"

sdk's config.yaml (only the information about orderer):

orderers:
  orderer.app.com:
    url: grpc://localhost:7050

    # these are standard properties defined by the gRPC library
    # they will be passed in as-is to gRPC client constructor
    grpcOptions:
      ssl-target-name-override: orderer.app.com
      # These parameters should be set in coordination with the keepalive policy on the server,
      # as incompatible settings can result in closing of connection.
      # When duration of the 'keep-alive-time' is set to 0 or less the keep alive client parameters are disabled
      keep-alive-time: 0s
      keep-alive-timeout: 20s
      keep-alive-permit: false
      fail-fast: false
      # allow-insecure will be taken into consideration if address has no protocol defined, if true then grpc or else grpcs
      allow-insecure: false

    tlsCACerts:
      # Certificate location absolute path
      path: ${GOPATH}/src/github.com/pfc/healthapp/crypto-config/ordererOrganizations/orderer.app.com/tlsca/tlsca.orderer.app.com-cert.pem

...

entityMatchers:

  orderer:
    - pattern: (\w*)orderer.app.com(\w*)
      urlSubstitutionExp: grpc://localhost:7050
      sslTargetOverrideUrlSubstitutionExp: orderer.app.com
      mappedHost: orderer.app.com

I've tried some tips from other posts like changing the url to localhost:7050, grpcs://localhost:7050, but nothing works

1

There are 1 best solutions below

0
coutinhotauan On

The "solution" that i've found to make everything works was disable TLS on docker containers and set allow-insecure to true on config.yaml. Maybe the problem was related to certificates and i didn't have time to work on this issue

Related Questions in HYPERLEDGER-FABRIC-SDK-GO