blockchain-explorer
blockchain-explorer copied to clipboard
fix: Catch error when _lifecycle chaincode is not running preventing Synchronizer to shutdown
What this PR does / why we need it:
Right now when you set up an empty network that just contains a peer and an orderer and you install an explorer on it it will crash the Synchronizer because it cannot find any chaincodes.
If it doesn't find any chaincodes it will fallback to the _lifecycle
chaincode and if that is not installed it will crash because the peer will answer with Peer XXXXX is not running chaincode _lifecycle
. If then later on blocks are being added or chaincode is installed it won't pick this up.
This is the error that it throws
2023-09-11T15:39:05.991Z - error: [SingleQueryHandler]: evaluate: message=Query failed. Errors: ["Error: Peer fab2p1-3041 is not running chaincode _lifecycle"], stack=FabricError: Query failed. Errors: ["Error: Peer fab2p1-3041 is not running chaincode │
│ at SingleQueryHandler.evaluate (/opt/explorer/node_modules/fabric-network/lib/impl/query/singlequeryhandler.js:66:23) │
│ at processTicksAndRejections (internal/process/task_queues.js:97:5) │
│ at async Transaction.evaluate (/opt/explorer/node_modules/fabric-network/lib/transaction.js:319:25), name=FabricError │
│ [2023-09-11T15:39:05.992] [ERROR] Sync - <<<<<<<<<<<<<<<<<<<<<<<<<< Synchronizer Error >>>>>>>>>>>>>>>>>>>>> │
│ [2023-09-11T15:39:05.992] [ERROR] Sync - Error [FabricError]: Query failed. Errors: ["Error: Peer fab2p1-3041 is not running chaincode _lifecycle"] │
│ at SingleQueryHandler.evaluate (/opt/explorer/node_modules/fabric-network/lib/impl/query/singlequeryhandler.js:66:23) │
│ at processTicksAndRejections (internal/process/task_queues.js:97:5) │
│ at async Transaction.evaluate (/opt/explorer/node_modules/fabric-network/lib/transaction.js:319:25) │
│ [2023-09-11T15:39:05.992] [INFO] Sync - <<<<<<<<<<<<<<<<<<<<<<<<<< Closing client processor >>>>>>>>>>>>>>>>>>>>>
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation, usage docs, etc.: