Liam
Liam

Reputation: 47

"Error getting endorser client for query" when trying cli interaction with hyperledger fabric example, despite successful installation

I'm currently trying to get the example for hyperledger fabric working. I get as far as starting the chaincode successfully using the deployCC script, and get the expected printout of all the cars after running the script. However, when I get to the next step of manually querying the network, I run into issue. I've run the exports for org1 as specified, and verified that the paths match and the tls cert and mspconfig exist in those locations. However, when I try to run the query command:

peer chaincode query -C mychannel -n fabcar -c '{"Args":["queryAllCars"]}'

I get the following error printout:

Error: error getting endorser client for query: endorser client failed to connect to 0.0.0.0:7051: failed to create new connection: context deadline exceeded

I would expect to get the same printout as at the end of the deployCC script, and I can't figure out why that isn't happening. Any help in diagnosing this is appreciated!

If it matters, I'm running this in a VM with Ubuntu 20.04. All the prerequisites are fresh installations of the latest versions from the last couple of days.

Upvotes: 0

Views: 337

Answers (1)

Rob Murgai
Rob Murgai

Reputation: 279

Liam, if you are able to see all the cars at the end of deployCC, then it might be an environment variables issue. Remember that you have to execute the peer chaincode query -C mychannel -n fabcar -c '{"Args":["queryAllCars"]}' command in the same terminal where you ran deployCC because the environment variables are all set in that window.

We can do a couple of things to confirm:

  1. Paste the output from DeployCC at the end, right after (and including)

    Querying chaincode on peer0.org1... 
    Using organization
    
  2. Print the following environment variables from the terminal window where you are executing deployCC and from the terminal window where you are executing the peer chaincode query -C mychannel -n fabcar -c '{"Args":["queryAllCars"]}' command

CORE_PEER_LOCALMSPID, 
CORE_PEER_TLS_ROOTCERT_FILE,
CORE_PEER_MSPCONFIGPATH, 
CORE_PEER_ADDRESS.

See if they match?

Upvotes: 2

Related Questions