PharmaLedger-IMI / blockchain-hlf-workspace

Workspace files to install HyperLedger fabric and test hf-adapter
MIT License
0 stars 0 forks source link

A few days ago, hlf-adapter started failing with Error: Peer peer0.org1.example.com:7051 is not running chaincode anchor #7

Closed joaoluis-pdm closed 1 year ago

joaoluis-pdm commented 1 year ago
...
Serving GET /get-last-version for  2eg3XSYLuY9m6WqTiuqrGAy3mMB9s3Bkq7WJiCZtfaXWEK3W4xiVFK6pAWuFbsCMsu8Hh9yUzwfnQ1xwmB3RRJCdMfXtsu9V5Gh13tatJQRpMr6cPv96nX8UHYCGST79w8rNvmys1MG6ww4VWtGzG7QP7Lj
2022-09-19T14:08:45.521Z - error: [SingleQueryHandler]: evaluate: message=Query failed. Errors: ["Error: Peer peer0.org1.example.com:7051 is not running chaincode anchor"], stack=FabricError: Query failed. Errors: ["Error: Peer peer0.org1.example.com:7051 is not running chaincode anchor"]
    at SingleQueryHandler.evaluate (/usr/src/app/node_modules/fabric-network/lib/impl/query/singlequeryhandler.js:66:23)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Transaction.evaluate (/usr/src/app/node_modules/fabric-network/lib/transaction.js:319:25)
    at async Object.getLastAnchorVersion (/usr/src/app/anchoring/getLastAnchorVersion.js:3:20), name=FabricError
Serving PUT /create-anchor :  2eg3XSYLuY9m6WqTiuqrGAy3mMB9s3Bkq7WJiCZtfaXWEK3W4xiVFK6pAWuFbsCMsu8Hh9yUzwfnQ1xwmB3RRJCdMfXtsu9V5Gh13tatJQRpMr6cPv96nX8UHYCGST79w8rNvmys1MG6ww4VWtGzG7QP7Lj 4qnrBhooj78L2psbyjJ44LqFA4DA5wdjVDeaJCoGmSGx2hZymcxpsbWcH55i8zDpmuWeAJEEzyPNv6diB3KBTudwTMaMsTEyfmwqCEVLbzvHXPPgGJKMFFAJXtotmimWqFj15hGssGf9xRUrT7nTrDoMp13sXk2o6eAu1RLZWm391K4je5coxEM9FDKAMMAyVYgbC35WrXtNvoh1QrDovUVVcE3bo2e7anWhrdNhbu
Call CreateAnchor for : 2eg3XSYLuY9m6WqTiuqrGAy3mMB9s3Bkq7WJiCZtfaXWEK3W4xiVFK6pAWuFbsCMsu8Hh9yUzwfnQ1xwmB3RRJCdMfXtsu9V5Gh13tatJQRpMr6cPv96nX8UHYCGST79w8rNvmys1MG6ww4VWtGzG7QP7Lj and [object Object]
2022-09-19T14:08:45.572Z - error: [DiscoveryResultsProcessor]: parseDiscoveryResults[anchor] - Channel:anchoring received discovery error:failed constructing descriptor for chaincodes:<name:"anchor" >
...
joaoluis-pdm commented 1 year ago

Seems that in the middle of the ./startInit.sh there is this error:

...
Using organization 1
+ peer lifecycle chaincode queryinstalled --output json
+ jq -r 'try (.installed_chaincodes[].package_id)'
scripts/ccutils.sh: line 25: jq: command not found
+ grep '^anchor_1.0:4cfdf12d102be30842199d3ea0329525726d69e6ecd100b0c75b3095fdbc7dce$'
+ res=1
Query installed on peer0.org1 has failed
Deploying chaincode-as-a-service failed
...

jq ???

Seems that someone added "jq" as a command line dependency to https://github.com/hyperledger/fabric-samples/ on https://github.com/hyperledger/fabric-samples/commit/4eff55b75b613a4a2b00ebea3893e5015225ca06 ( https://github.com/hyperledger/fabric-samples/pull/827 )

Lets install jq to see if it helps...

./startInit.sh will check for jq

joaoluis-pdm commented 1 year ago
root@fgt-dev-pl:~# apt install jq

Does not work. Fails executing

peer chaincode query -C anchoring -n anchor -c  '{"Args":["check"]}'

with error

Error: endorsement failure during query. response: status:500 message:"error in simulation: failed to execute transaction 280e018e0b25111673a4782934139f93ad80286d5bd33c1c2965738f0f56976e: error sending: timeout expired while executing transaction" 
joaoluis-pdm commented 1 year ago

ccaas logs:

pharmaledger@fgt-dev-pl:~/blockchain-hf-workspace$ docker logs peer0org2_anchor_ccaas
Using env CHAINCODE_ID :  anchor_1.0:46935ce9cd40d04d4429f61b84fa93dd05509faafb043b5bf331e69f2fbae911 string
Using env CHAINCODE_SERVER_ADDRESS :  0.0.0.0:9999 string
2022-09-19T16:08:48.504Z info [c-api:lib/handler.js]                              Successfully registered with peer node. State transferred to "established"  
2022-09-19T16:08:48.504Z info [c-api:lib/handler.js]                              Successfully established communication with peer node. State transferred to "ready"  
pharmaledger@fgt-dev-pl:~/blockchain-hf-workspace$ docker logs peer0org1_anchor_ccaas
Using env CHAINCODE_ID :  anchor_1.0:46935ce9cd40d04d4429f61b84fa93dd05509faafb043b5bf331e69f2fbae911 string
Using env CHAINCODE_SERVER_ADDRESS :  0.0.0.0:9999 string
2022-09-19T16:08:48.509Z info [c-api:lib/handler.js]                              Successfully registered with peer node. State transferred to "established"  
2022-09-19T16:08:48.510Z info [c-api:lib/handler.js]                              Successfully established communication with peer node. State transferred to "ready"  
Transaction ID: 280e018e0b25111673a4782934139f93ad80286d5bd33c1c2965738f0f56976e
Args: ["check"]
Calling function: check
Calling parameters: 
2022-09-19T16:08:48.715Z error [c-api:_]                                          Unhandled Rejection reason SyntaxError: Unexpected token '?' promise Promise {
  <rejected> /cc-home/privatesky/psknode/bundles/openDSU.js:24915
      this.requestTimeout = requestTimeout ?? DEFAULT_TIMEOUT;
                                            ^

  SyntaxError: Unexpected token '?'
      at wrapSafe (internal/modules/cjs/loader.js:915:16)
      at Module._compile (internal/modules/cjs/loader.js:963:27)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
      at Module.load (internal/modules/cjs/loader.js:863:32)
      at Function.Module._load (internal/modules/cjs/loader.js:708:14)
      at Module.require (internal/modules/cjs/loader.js:887:19)
      at require (internal/modules/cjs/helpers.js:74:18)
      at AnchorChaincode.Invoke (/cc-home/cc-anchor/lib/controller/AnchorChaincode.js:23:9)
      at handleMessage (/cc-home/cc-anchor/node_modules/fabric-shim/lib/handler.js:602:47)
      at ChaincodeMessageHandler.handleTransaction (/cc-home/cc-anchor/node_modules/fabric-shim/lib/handler.js:390:9)
}  
Transaction ID: 1a817ff228ceb991375dd639ce4da3373005b36def64e709fc34d980a2447b5b
Args: ["check"]
Calling function: check
Calling parameters: 
2022-09-19T16:14:24.212Z error [c-api:_]                                          Unhandled Rejection reason SyntaxError: Unexpected token '?' promise Promise {
  <rejected> /cc-home/privatesky/psknode/bundles/openDSU.js:24915
      this.requestTimeout = requestTimeout ?? DEFAULT_TIMEOUT;
                                            ^

  SyntaxError: Unexpected token '?'
      at wrapSafe (internal/modules/cjs/loader.js:915:16)
      at Module._compile (internal/modules/cjs/loader.js:963:27)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
      at Module.load (internal/modules/cjs/loader.js:863:32)
      at Function.Module._load (internal/modules/cjs/loader.js:708:14)
      at Module.require (internal/modules/cjs/loader.js:887:19)
      at require (internal/modules/cjs/helpers.js:74:18)
      at AnchorChaincode.Invoke (/cc-home/cc-anchor/lib/controller/AnchorChaincode.js:23:9)
      at handleMessage (/cc-home/cc-anchor/node_modules/fabric-shim/lib/handler.js:602:47)
      at ChaincodeMessageHandler.handleTransaction (/cc-home/cc-anchor/node_modules/fabric-shim/lib/handler.js:390:9)
}  
Transaction ID: 1888ec030ff7d38236d2320b3db3ad0d064dd5ab7b903b19de988c0a930355cc
Args: ["org.hyperledger.fabric:GetMetadata"]
Calling function: org.hyperledger.fabric:GetMetadata
Calling parameters: 
2022-09-19T16:42:39.513Z error [c-api:_]                                          Unhandled Rejection reason SyntaxError: Unexpected token '?' promise Promise {
  <rejected> /cc-home/privatesky/psknode/bundles/openDSU.js:24915
      this.requestTimeout = requestTimeout ?? DEFAULT_TIMEOUT;
                                            ^

  SyntaxError: Unexpected token '?'
      at wrapSafe (internal/modules/cjs/loader.js:915:16)
      at Module._compile (internal/modules/cjs/loader.js:963:27)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
      at Module.load (internal/modules/cjs/loader.js:863:32)
      at Function.Module._load (internal/modules/cjs/loader.js:708:14)
      at Module.require (internal/modules/cjs/loader.js:887:19)
      at require (internal/modules/cjs/helpers.js:74:18)
      at AnchorChaincode.Invoke (/cc-home/cc-anchor/lib/controller/AnchorChaincode.js:23:9)
      at handleMessage (/cc-home/cc-anchor/node_modules/fabric-shim/lib/handler.js:602:47)
      at ChaincodeMessageHandler.handleTransaction (/cc-home/cc-anchor/node_modules/fabric-shim/lib/handler.js:390:9)
} 
joaoluis-pdm commented 1 year ago

Asking OpenDSU support on slack (channel anchoring-implementation) to: upgrade the https://github.com/PharmaLedger-IMI/hf-adapter/blob/master/cc-anchor/Dockerfile#L1 from node:12 to node:14 (at least), and if possible provide a frozen version (octopus-freeze.json version of octopus.json) so that privatesky is not updated on every install.

joaoluis-pdm commented 1 year ago

No good solution for now on 2 fronts: