IBM / blockchain-network-on-kubernetes

Demonstrates the steps involved in setting up your business network on Hyperledger Fabric using Kubernetes APIs on IBM Cloud Kubernetes Service.
https://developer.ibm.com/patterns/deploy-hyperledger-fabric-network-on-ibm-cloud/
Apache License 2.0
316 stars 183 forks source link

Failed to evaluate transaction: FabricError: No peers available to query. Errors: [] #75

Closed aslihn closed 3 years ago

aslihn commented 3 years ago

I've ran setup_blockchainNetwork_v2.sh, installed, queried, invoked fabcar chaincode succesfully within peer bash sheel. I've received admin and user identities via 'fabric-ca-client' using enrolAdmin.js and registerUser.js . I'm using IBM free kubernetes cluster, Hyperledger Fabric 1.4 and following Hyperledger Fabcar tutorial steps.

But when I ran query.js I've got the following error

error: [SingleQueryHandler]: evaluate: message=No peers available to query. Errors: [], stack=FabricError: No peers available to query. Errors: [] at SingleQueryHandler.evaluate (/home/ubuntu/Fabric-Ex/fabcar/javascript/node_modules/fabric-network/lib/impl/query/singlequeryhandler.js:44:17) at Transaction.evaluate (/home/ubuntu/Fabric-Ex/fabcar/javascript/node_modules/fabric-network/lib/transaction.js:323:29) at Contract.evaluateTransaction (/home/ubuntu/Fabric-Ex/fabcar/javascript/node_modules/fabric-network/lib/contract.js:173:39) at main (/home/ubuntu/Fabric-Ex/fabcar/javascript/query.js:41:39) at <anonymous>, name=FabricError Failed to evaluate transaction: FabricError: No peers available to query. Errors: []

Connection profile as follows `

"name": "channel1",
"version": "1.0.0",
"client": {
    "organization": "Org1MSP"      
},
"organizations": {
    "Org1MSP": {
        "mspid": "Org1MSP",
        "peers": [
            "org1peer1",
            "org2peer1"                           
        ],
        "certificateAuthorities": [
            "ca"
        ]           
    }
},
"orderers": {
    "orderer": {
        "url":"grpc://184.172.233.104:31010"
    }
},
"peers": {
    "org1peer1": {
        "url": "grpc://184.172.233.104:30110"

    },
    "org2peer1": {
        "url": "grpc://184.172.233.104:30210"
    }
},
"certificateAuthorities": {
    "ca": {
        "url": "http://184.172.233.104:30054",
        "caName": "CA1"           
    }
}

` Please let me know if you have any ideas how to fix this issue.

maheshwarishikha commented 3 years ago

@aslihn - I understand that all command-line is working for you as explained in this repo. Now your trying to connect through SDK. There are other repositories which can give you more details on that. But as far as this connection profile is considered, I think "channel" details are missing in it. API needs channel details to reach to a peer...You can try this once. Thanks.

maheshwarishikha commented 3 years ago

Hope this might have worked for you. So closing the issue, feel free to open new issue if required.