0

When trying to initialize the SDK with my local network I'm facing below issue. I saw some similar posts in which it is mentioned that by adding entityMachers in config.yaml file fix this issue but even after adding the entityMatchers I'm facing this issue.

alpha@GHOST-RIDER:/c/Projects/Go/src/github.com/hyperledger/firstproject$ ./firstproject
SDK created
Resource management client created
value of req is:  {testchannelid <nil> /c/Projects/Go/src/github.com/hyperledger/firstproject/firstproject-network/artifacts/channel.tx [0xc0001e0fa0]}
Value of setup.Orderer is:  orderer.firstproject.com
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]

config.yaml

orderers:
  orderer.firstproject.com:
    url: localhost:7050

    grpcOptions:
      ssl-target-name-override: orderer.firstproject.com
      keep-alive-time: 0s
      keep-alive-timeout: 20s
      keep-alive-permit: false
      fail-fast: false
      allow-insecure: true

    tlsCACerts:
      # Certificate location absolute path
      path: /c/Projects/Go/src/github.com/hyperledger/firstproject/firstproject-network/crypto-config/ordererOrganizations/firstproject.com/tlsca/tlsca.firstproject.com-cert.pem

entityMatchers:
    orderer:
        - pattern: (\w+).firstproject.(\w+):(\d+)
          urlSubstitutionExp: localhost:7050
          sslTargetOverrideUrlSubstitutionExp: orderer.firstproject.com
          mappedHost: orderer.firstproject.com  

        - pattern: (\w+).firstproject.(\w+)
          urlSubstitutionExp: localhost:7050
          sslTargetOverrideUrlSubstitutionExp: orderer.firstproject.com
          mappedHost: orderer.firstproject.com

docker status

    alpha@GHOST-RIDER:/c/Projects/Go/src/github.com/hyperledger/firstproject$ docker ps
    CONTAINER ID        IMAGE                               COMMAND                  CREATED             STATUS              PORTS                                            NAMES
    6ccd2d384082        hyperledger/fabric-peer:latest      "peer node start"        33 minutes ago      Up 33 minutes       0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp   peer0.org1.firstproject.com
    0956d1988170        hyperledger/fabric-peer:latest      "peer node start"        33 minutes ago      Up 33 minutes       0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp   peer1.org1.firstproject.com
    6a5018a5cca4        hyperledger/fabric-orderer:latest   "orderer"                33 minutes ago      Up 33 minutes       0.0.0.0:7050->7050/tcp                           orderer.firstproject.com
    4f6e8e0f6c48        hyperledger/fabric-ca:latest        "sh -c 'fabric-ca-se…"   33 minutes ago      Up 33 minutes       0.0.0.0:7054->7054/tcp                           ca.org1.firstproject.com            
metadata
  • 1,139
  • 1
  • 7
  • 28
  • even adding the orderer.firstpost.com in /etc/hosts file isn't working – metadata Apr 25 '19 at 07:44
  • 1
    Looks like you are running on Windows? Windows 7 or Windows 10? Docker Toolbox or Docker for Windows? If using Docker Toolbox, you won't be able to access Docker containers via localhost or 127.0.0.1; when you open the Docker Quickstart terminal, it will tell you the address on which containers are exposed – Gari Singh Apr 25 '19 at 08:34
  • running on windows 10 and using docker for windows. docker-compose up command is working fine. – metadata Apr 25 '19 at 09:34
  • facing similar issue on Ubuntu machine too – metadata Apr 25 '19 at 09:35
  • added docker status in the question – metadata Apr 25 '19 at 10:34
  • In docker orderer container logs I found this `2019-04-25 11:00:02.314 UTC [orderer.common.server] Start -> INFO 2a1 Beginning to serve requests` `2019-04-25 11:08:43.553 UTC [core.comm] ServerHandshake -> ERRO 2a2 TLS handshake failed with error tls: first record does not look like a TLS handshake server=Orderer remoteaddress=192.168.96.1:38760` – metadata Apr 25 '19 at 11:14
  • 2
    Try changing `url: localhost:7050` to `url: grpcs://localhost:7050` – Gari Singh Apr 25 '19 at 11:36
  • it works but stops with this erro `2019-04-25 11:39:47.841 UTC [orderer.common.broadcast] ProcessMessage -> WARN 2b1 [channel: testchannelid] Rejecting broadcast of config message from 192.168.96.1:38774 because of error: Failing initial channel config creation: mismatched channel IDs: 'testchainid' != 'testchannelid'` – metadata Apr 25 '19 at 11:40

1 Answers1

0

Using domain name in sdk's config.yaml:

url : grpcs://peer0.org1.example.com:7050

and add below to hosts:

127.0.0.1 peer0.org1.example.com

is NOT work. It will got the same error.

Using ip address in sdk's config.yaml will be work:

url : grpcs://localhost:7050
James Shi
  • 1,894
  • 2
  • 13
  • 16