Welcome to the Linux Foundation Forum!

Lab 6.1: Chaincode for Report Generation couchdb errors

I am gettting the following error when running the Lab 6.1 step: peer chaincode query -n reports -C mychannel -c '{"Args":["getAnnualReport", "2019"]}' -o orderer.example.com:7050

-- Error ---

Error: endorsement failure during query. response: status:500 message:"unable to perform a rich query using the query string {\"selector\":{\"date\":{\"year\":2019}}, \"use_index\":[\"_design/indexYearDoc\", \"indexYear\"]}: GET_QUERY_RESULT failed: transaction ID: 9792d735c41af848b09a39fa642f1b45c9fef4d4c876c6866d530a853e39919a: ExecuteQuery not supported for leveldb"

I run command
root@ae2a46edf3b1:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode query -n reports -C mychannel -c '{"Args":["generateCustomReport", "{\"selector\": {\"price\": {\"$lt\":0}}}"]}' -o orderer.example.com:7050

-- Error --

Error: endorsement failure during query. response: status:500 message:"unable to perform a rich query using the query string {\"selector\": {\"price\": {\"$lt\":0}}}: GET_QUERY_RESULT failed: transaction ID: abf4fe51e1c92170a0ca57647269172f72bf353c43a6608bacbcafc9b8d46b11: ExecuteQuery not supported for leveldb"
root@ae2a46edf3b1:/opt/gopath/src/github.com/hyperledger/fabric/peer#

The Lab 6.1 steps below run fine.

jimmys@jimmys-VirtualBox:~/go/src/github.com/hyperledger/fabric-samples/basic-network$ docker exec -it cli bash
root@ae2a46edf3b1:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode install -n reports -v 1.0 -p github.com/chaincode/reports_chaincode/go -l golang
2021-04-28 00:51:45.318 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2021-04-28 00:51:45.318 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2021-04-28 00:51:45.558 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:
root@ae2a46edf3b1:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode list --installed
Get installed chaincodes on peer:
Name: mycc, Version: 1.0, Path: github.com/chaincode/chaincode_example02/go/, Id: 476fca1a949274001971f1ec2836cb09321f0b71268b3762d68931c93f218134
Name: mycc, Version: 2.0, Path: github.com/chaincode/chaincode_example02/go/, Id: 9dd24a058c56bbafe0a4bb2479d58d6950f589b627b73c7029e010f460a7c7d3
Name: reports, Version: 1.0, Path: github.com/chaincode/reports_chaincode/go, Id: 5c890ce80a46326405bbcefa43b9cb52fb8e152bc1d71ebda9b137c2cd3ee24c
root@ae2a46edf3b1:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode instantiate -n reports -v 1.0 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -c '{"Args":[]}' -o orderer.example.com:7050
2021-04-28 00:52:14.425 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2021-04-28 00:52:14.425 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Comments

  • Posts: 193

    @jjsull1van , Hi Jim, It looks like it is having issue with creating records in the ​Init​ function to populate the ledger with the initial data. When you finished adding records did you receive the "return​ shim.​Success​(​nil​)" Statement?

  • Is there a step to call the function to populate the records? I do not see a separate step. I only see the query

  • It looks like the records are populated in the Init function. Dose the Init run automatically on the install? My install successfully runs.

  • I mean instantiation runs the Init function. My Instantiation runs fine.

  • The install ran successfully
    The instantiate ran successfully. This is where the Init runs and adds the new records.
    The query returns an error

    ~/go/src/github.com/hyperledger/fabric-samples/first-network$ docker exec -it cli bash
    root@8ad7a44243be:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode install -n reports -v 1.0 -p github.com/chaincode/reports_chaincode/go -l golang
    2021-04-28 22:33:12.274 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
    2021-04-28 22:33:12.275 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
    2021-04-28 22:33:12.461 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:

    root@8ad7a44243be:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode instantiate -n reports -v 1.0 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -c '{"Args":[]}' -o orderer.example.com:7050
    2021-04-28 22:33:31.915 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
    2021-04-28 22:33:31.915 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
    root@8ad7a44243be:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode query -n reports -C mychannel -c '{"Args":["getAnnualReport", "2019"]}' -o orderer.example.com:7050

    Error: endorsement failure during query. response: status:500 message:"unable to perform a rich query using the query string {\"selector\":{\"date\":{\"year\":2019}}, \"use_index\":[\"_design/indexYearDoc\", \"indexYear\"]}: GET_QUERY_RESULT failed: transaction ID: ee08543ff6b3685d53192c2b7cc7b391070f6591c19a62b9d72223744bcc067c: ExecuteQuery not supported for leveldb"
    root@8ad7a44243be:/opt/gopath/src/github.com/hyperledger/fabric/peer#

  • Hi @jjsull1van,

    Your error message states that rich queries are not supported by LevelDB. Make sure you followed the prerequisites for the lab correctly and started a network with CouchDB enabled as a state database.

    The exercise is based on basic-network, so check basic-network/docker-compose.yml file. It should define all CouchDB-related variables under peer1's environment section:

    1. peer0.org1.example.com:
    2. container_name: peer0.org1.example.com
    3. image: hyperledger/fabric-peer
    4. environment:
    5. # <...>
    6. - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
    7. - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb:5984
    8. - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=
    9. - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=
    10. # <...>

    Best regards,
    Ilya

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training