Vasav
Vasav

Reputation: 21

Hyperledger composer Rest API filter not working for asset

I am trying to execute Rest API using following filter

api/Commodity?filter={"where":{"owner":"resource:org.example.mynetwork.Trader%231"},%20"include":"resolve"}

but getting following error -

{"error":{"statusCode":500,"name":"Error","message":"2 UNKNOWN: error executing chaincode: transaction returned with failure: Error: ExecuteQuery not supported for leveldb","code":2,"metadata":{"_internal_repr":{}},"details":"error executing chaincode: transaction returned with failure: Error: ExecuteQuery not supported for leveldb","stack":"Error: 2 UNKNOWN: error executing chaincode: transaction returned with failure: Error: ExecuteQuery not supported for leveldb\n at new createStatusError (/home/composer/.npm-global/lib/node_modules/@ibmblockchain/composer-rest-server/node_modules/grpc/src/client.js:64:15)\n at /home/composer/.npm-global/lib/node_modules/@ibmblockchain/composer-rest-server/node_modules/grpc/src/client.js:583:15"}}

Kindly suggest what is wrong here?

Upvotes: 1

Views: 746

Answers (1)

david_k
david_k

Reputation: 5868

The important part of the response is here Error: ExecuteQuery not supported for leveldb

This says that your fabric is configured to use the inbuilt leveldb system for storing the world state. Because of this you cannot perform any type of query on it, and that includes rest filters.

You need to change your fabric setup to use couchdb as the world state store instead.

Fabric documentation can be found here about building fabric networks and on this page there is a specific section about enabling couchdb. see https://hyperledger-fabric.readthedocs.io/en/release-1.2/build_network.html

Upvotes: 1

Related Questions