0

I am using Hyperledger Fabric 2.1 container in server-1 and node SDK in server-2. My connection-org.json file is given as:

{
    "name": "first-network-org2",
    "version": "1.0.0",
    "client": {
        "organization": "Org2",
        "connection": {
            "timeout": {
                "peer": {
                    "endorser": "300"
                }
            }
        }
    },
    "organizations": {
        "Org2": {
            "mspid": "Org2MSP",
            "peers": [
                "peer0.org2.example.com",
                "peer1.org2.example.com"
            ],
            "certificateAuthorities": [
                "ca.org2.example.com"
            ]
        }
    },
    "peers": {
        "peer0.org2.example.com": {
            "url": "grpcs://192.168.43.233:9051",
            "tlsCACerts": {
                "pem": "pen file here"
            },
            "grpcOptions": {
                "ssl-target-name-override": "peer0.org2.example.com",
                "hostnameOverride": "peer0.org2.example.com"
            }
        },
        "peer1.org2.example.com": {
            "url": "grpcs://192.168.43.233:10051",
            "tlsCACerts": {
                "pem": "pemfile here"
            },
            "grpcOptions": {
                "ssl-target-name-override": "peer1.org2.example.com",
                "hostnameOverride": "peer1.org2.example.com"
            }
        }
    },
    "certificateAuthorities": {
        "ca.org2.example.com": {
            "url": "https://192.168.43.233:8054",
            "caName": "ca.org2.example.com",
            "tlsCACerts": {
                "pem": "pem file here"
            },
            "httpOptions": {
                "verify": false
            }
        }
    }
}

When I try to invoke the chaincode from Fabric Node SDK, I get the error below:

2020-07-09T13:12:19.615Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer0.org2.example.com:9051, url:grpcs://peer0.org2.example.com:9051
2020-07-09T13:12:19.615Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer0.org2.example.com:9051 url:grpcs://peer0.org2.example.com:9051 timeout:3000
2020-07-09T13:12:19.615Z - error: [DiscoveryService]: _buildPeer[verificationchannel] - Unable to connect to the discovered peer peer0.org2.example.com:9051 due to Error: Failed to connect before the deadline on Endorser- name: peer0.org2.example.com:9051, url:grpcs://peer0.org2.example.com:9051

What can I do to be able to invoke the chaincode? Is there something that should be changed in the docker-compose configuration?

Xhens
  • 804
  • 3
  • 13
  • 33
  • This question needs a bit more detail. Is the address `peer0.org2.example.com:9051` routable from your application container? There is a strong possibility that this is simply a docker networking problem, rather than anything related to Fabric. – Jason Yellick Jul 10 '20 at 03:13
  • It's a general error which can arise due to many other errors. Try to inspect logs of the peer and orderer containers for more details – D.Zotov Jul 10 '20 at 19:22
  • Thanks your command.. But I added my ip address in /etc/hosts then it's working fine. Like 172.17.0.1 peer0.org2. example. com – Anantha Kannan Jul 25 '20 at 19:03

0 Answers0