Two months ago, I've written an application using Hyperledger Fabric. Now, I try to run it again, but I get error and I can't resolve it. So I go the the Hyperledger Fabric doc again(https://hyperledger-fabric.readthedocs.io/en/latest/install.html), and reinstall everything(including cmd tools, docker images and even my MacOS).
I've tried two versions(v2.0.1 and v2.1.0), and my node version is v12. What I do is:
download the fabric-samples repo using cmd (
curl -sSL https://xxx/2ysbOFE | bash -s -- 2.1.0 1.4.6 0.4.18
)and go the fabcar/ directory and run
./startFabric.sh
and go the fabrcar/javascript/ directory and run
npm install && node enrollAdmin.js && node registerUser.js && node invoke.js
However, I meet this error again:
2020-05-07T06:39:28.354Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer0.org1.example.com, url:grpcs://localhost:7051
2020-05-07T06:39:28.356Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer0.org1.example.com url:grpcs://localhost:7051 timeout:3000
2020-05-07T06:39:28.360Z - error: [NetworkConfig]: buildPeer - Unable to connect to the endorser peer0.org1.example.com due to Error: Failed to connect before the deadline on Endorser- name: peer0.org1.example.com, url:grpcs://localhost:7051
at checkState (/Users/xiebei/code/fabric-samples/fabcar/javascript/node_modules/grpc/src/client.js:883:16) {
connectFailed: true
}
2020-05-07T06:39:31.363Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Discoverer- name: peer0.org1.example.com, url:grpcs://localhost:7051
2020-05-07T06:39:31.363Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer0.org1.example.com url:grpcs://localhost:7051 timeout:3000
Failed to evaluate transaction: Error: Failed to connect before the deadline on Discoverer- name: peer0.org1.example.com, url:grpcs://localhost:7051
I use docker ps: enter image description here
Seems everything goes ok. And the orderer node docker logs is :
2020-05-07 06:12:07.554 UTC [orderer.consensus.etcdraft] propose -> INFO 059 Created block [5], there are 0 blocks in flight channel=mychannel node=1
2020-05-07 06:12:07.558 UTC [orderer.consensus.etcdraft] writeBlock -> INFO 05a Writing block [5] (Raft index: 7) to ledger channel=mychannel node=1
2020-05-07 06:12:07.788 UTC [orderer.common.broadcast] Handle -> WARN 05b Error reading from 172.18.0.1:36216: rpc error: code = Canceled desc = context canceled
2020-05-07 06:12:07.789 UTC [comm.grpc.server] 1 -> INFO 05c streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Broadcast grpc.peer_address=172.18.0.1:36216 error="rpc error: code = Canceled desc = context canceled" grpc.code=Canceled grpc.call_duration=2.257323471s
2020-05-07 06:12:14.117 UTC [orderer.common.broadcast] Handle -> WARN 05d Error reading from 172.18.0.1:36256: rpc error: code = Canceled desc = context canceled
2020-05-07 06:12:14.117 UTC [comm.grpc.server] 1 -> INFO 05e streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Broadcast grpc.peer_address=172.18.0.1:36256 error="rpc error: code = Canceled desc = context canceled" grpc.code=Canceled grpc.call_duration=61.170986ms
2020-05-07 06:12:16.114 UTC [orderer.consensus.etcdraft] propose -> INFO 05f Created block [6], there are 0 blocks in flight channel=mychannel node=1
2020-05-07 06:12:16.117 UTC [orderer.consensus.etcdraft] writeBlock -> INFO 060 Writing block [6] (Raft index: 8) to ledger channel=mychannel node=1
It seems like that the orderer can't connect to something(maybe the peer node). So I think there's some possible problems:
- Maybe the peer node's network is failed, we can't connect to it.
- Maybe the NodeJS Fabric SDK is buggy, it's GRPC client can't works well.
- Maybe my computer goes wrong.
Could you please help me? Thanks!!!