hyperledger / fabric-gateway

Go, Node and Java client API for Hyperledger Fabric v2.4+
https://hyperledger.github.io/fabric-gateway/
Apache License 2.0
151 stars 88 forks source link

Unexpected error message when chaincode id doesn't exist #199

Closed davidkel closed 2 years ago

davidkel commented 2 years ago

In both Go and Node clients If I specify a non existent chaincode then I get the following on evaluate

no endorsing peers found for channel: mychannel

Which isn't really telling me that I have not provided the correct chaincode id.

On a submit I get something a little more helpful

discovery service failed to build endorsement plan: No metadata was found for chaincode fixed-asset1 in channel mychannel

But still that error could be more helpful to say that there is no chaincode with this ID instantiated on that channel

bestbeforetoday commented 2 years ago

Relates to #178

andrew-coleman commented 2 years ago

I can change the first message (evaluate) to also include the chaincode name. I can't say that you've spelled the chaincode wrong because you might well have spelled the channel name wrong. All I can say this there are no endorsing peers with that combination of chaincode/channel names.

I can change the second message to start with: no combination of peers can be derived which satisfy the endorsement policy: rather than: discovery service failed to build endorsement plan: but the rest of the message is generated from the discovery service. There can be so many reasons why this could error - the discovery service is trying to combine all the (potentially conflicting) policies from the chaincodes (there could be chaincode to chaincode calls), private data collections and SBE policies. At the gateway level, all I can say is that some combination of that failed.

andrew-coleman commented 2 years ago

Resolved by https://github.com/hyperledger/fabric/pull/2963