Hyperledger Fabric | Production| Errors & Solutions

Hello Friends, I have complete 1 year development experience with hyperledger fabric and delivered few projects and I would like to share few errors, pitfalls, landmines with solutions and reasons, these errors i encountered when i do development, I will try to give full explanation.

So, This article main aim is to help others to solve the errors that are quite often and sometimes strange as well during your development stage. I faced many errors, few are silly mistakes, few are network issues, few are naming conventions, few are common errors, few are strange — Everything is perfect but error thrown| not working so these are basically from out of our border(out of developer) but in our control like docker demon errors, swarm errors, event hub errors, heavy load on servers then requests are not processed, certificates mis match error, MSP error’s, node grpc errors etc etc a lot …..

So lets deep dive

I will cover both errors from network has[identities generated by cryptogen tool & fabric-ca].

We have a lot in our stack so will categories errors and I will update this article when ever I encounter new error !! Stay tuned !!

1) Nodejs (client)
2) hyperledger fabric
3) docker
4) swarm
5) entity to entity communication errors Ex: orderer to orderer
6) Mutual TLS

Errors from NodeJS(client):

Error 1: node-gyp errors

gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.5.0

Solution: My best suggestion is always install Nodejs by using NVM(Node version Manager)

sudo apt-get install build-essential libssl-dev

Always use stable version of NodeJS

Ex: v8.12.0 (Latest LTS: Carbon) — It should show green color

Error 2: certificate is invalid [Cannot read property ‘curve’ of undefined]

error: [Client.js]: Failed to load user “maersksea-ica” from local key value store. Error: TypeError: Cannot read property ‘curve’ of undefined
 at Object.KEYUTIL.getKey (/home/server/Downloads/bg-projects/adminTasks/node_modules/jsrsasign/lib/jsrsasign.js:247:10379)
 at CryptoSuite_ECDSA_AES.getKey (/home/server/Downloads/bg-projects/adminTasks/node_modules/fabric-client/lib/impl/CryptoSuite_ECDSA_AES.js:204:27)
 at <anonymous>

Above scenario tried to register a new user with wrong CAadmin certificates

Solution: certificate you provided is invalid check using below online tools

  1. https://ssldecoder.org/
  2. https://www.sslshopper.com/certificate-key-matcher.html

Error 3: wrong chaincode name | instantiation failed, but try to invoke

error: [client-utils.js]: sendPeersProposal — Promise is rejected: Error: make sure the chaincode rate has been successfully instantiated and try again: getccdata public/rate responded with error: could not find chaincode with name ‘rate’
 at /home/server/Downloads/fabric-ca-network/client-node/node_modules/fabric-client/lib/Peer.js:114:16
 at /home/server/Downloads/fabric-ca-network/client-node/node_modules/grpc/src/client.js:586:7

Solution: Generally join peers to channels is like to identify which peers are belongs to which channel, same way install chaincode in all peers OK but to identify which chaincode belongs to which channel, we need to successfully instantiated chaincode, this is one time transaction and happened in channel

try to resolve problems with instantiate chaincode, if you encounter docker problems refer docker section.

Error 4: Failed to create the channel ‘public’

NodeJS Logs: [2018–10–04 12:19:28.548] [DEBUG] Create-Channel — response ::{“status”:”BAD_REQUEST”,”info”:”error authorizing update: error validating DeltaSet: policy for [Group] /Channel/Application not satisfied: Failed to reach implicit threshold of 1 sub-policies, required 1 remaining”}
[2018–10–04 12:19:28.548] [ERROR] Create-Channel — 
!!!!!!!!! Failed to create the channel ‘public’ !!!!!!!!!

Orderer Logs: reg channel creation error

2018–10–04 08:19:28.617 UTC [orderer/common/broadcast] Handle -> WARN 132 [channel: public] Rejecting broadcast of config message from 10.255.0.2:57714 because of error: error authorizing update: error validating DeltaSet: policy for [Group] /Channel/Application not satisfied: Failed to reach implicit threshold of 1 sub-policies, required 1 remaining

Reason: transaction is not signed with admin key

Solution: To create a channel we need admin credentials such as private key & public certificate(Ex: x.509)

Error 5: reg channel creation error

NodeJS Logs: [2018–10–05 11:29:21.358] [DEBUG] Create-Channel — response ::{“status”:”BAD_REQUEST”,”info”:”error authorizing update: error validating ReadSet: readset expected key [Group] /Channel/Application at version 0, but got version 1"}
OrdererLogs:

2018–10–05 07:29:21.329 UTC [orderer/common/broadcast] Handle -> WARN bca [channel: public] Rejecting broadcast of config message from 10.255.0.2:44136 because of error: error authorizing update: error validating ReadSet: readset expected key [Group] /Channel/Application at version 0, but got version 1

Reason: Simple channel(public) is already created and try to create channel(public) again means error.

Error 6: reg Policy error

{ status: ‘BAD_REQUEST’,
 info: ‘error authorizing update: error validating DeltaSet: policy for [Group] /Channel/Orderer not satisfied: Failed to reach implicit threshold of 2 sub-policies, required 1 remaining’ }
[2018–10–24 12:25:04.411] [DEBUG] Update-Channel — response3 ::{“status”:”BAD_REQUEST”,”info”:”error authorizing update: error validating DeltaSet: policy for [Group] /Channel/Orderer not satisfied: Failed to reach implicit threshold of 2 sub-policies, required 1 remaining”}

Reason: While update the channel make sure you got majority of signatures from all organisations.

Update: Add/Remove an organisation from the network.

Error 7: connection issue

error: [Remote.js]: Error: Failed to connect before the deadline
[2018–10–24 13:09:48.602] [ERROR] Join-Channel — Error: Failed to connect before the deadline
 at checkState (/home/server/Downloads/fabric-ca-network/TwoOrgs-ThirdLater/Org3/client-node/node_modules/grpc/src/client.js:838:16)
[2018–10–24 13:09:48.602] [ERROR] Join-Channel — Failed to join all peers to channel. cause:Error: Failed to connect before the deadline

Reason: grpcs IP and port is correct but ssl target name has been changed

Ex: If orderer name is enoc-orderer-enoc then ssl-target-name also should beenoc-orderer-enoc.

Error 8: Failed disseminating 2 out of 2 private RWSets

Peer Logs:

Org2_maersk-peer-maersk.1.05eunxk7gplx@devserver1 | 2018–10–29 10:15:08.814 UTC [gossip/gossip] learnAnchorPeers -> WARN 034 Got empty hostname, skipping connecting to anchor peer { 7051}
Org2_maersk-peer-maersk.1.05eunxk7gplx@devserver1 | 2018–10–29 10:15:08.814 UTC [gossip/gossip] learnAnchorPeers -> WARN 035 Got invalid port (0), skipping connecting to anchor peer {maersksea-peer-maersksea 0}
Org2_maersk-peer-maersk.1.05eunxk7gplx@devserver1 | 2018–10–29 10:15:08.814 UTC [gossip/gossip] learnAnchorPeers -> WARN 036 Got empty hostname, skipping connecting to anchor peer { 7051}

Reason: we need to define Anchor Peers for cross Org Communication

Note: Anchor peers are differ to leader peers.

Make sure you update Anchor peers after join peers