Querying chaincode is only successful in ~3/5 cases with nodejs

后端 未结 1 1721
花落未央
花落未央 2021-01-14 09:11

I successfully installed and instantiated chaincode on my chain. I\'m able to enroll the admin and register a user trough nodejs. If I query the chaincode it only returns a

1条回答
  •  孤城傲影
    2021-01-14 09:18

    Looking at the logs I can see why sometimes you get peer0 and occasionally you get peer1, and that is because the discovery results and processing result in it not being possible to get the list of peers in any particular order so with 2 peers in your org and the fact that this is not a long running app but a short running invocation sometimes peer0 will be first in the list of peers and sometimes peer1. Because you have only installed the chaincode on peer0, peer1 can't honour the evaluate request and return an error.

    The node-sdk should detect this and then try peer0 but either you are using an older version of the node-sdk which definitely had an issue where it did not try a different peer or the node-sdk is thinking this is (incorrectly, but may not be able to distinguish) a chaincode response and passes that back to the caller. The solution to avoid the error is to install the chaincode on all the peers.

    0 讨论(0)
提交回复
热议问题