failed constructing descriptor for chaincodes

4.1k views Asked by At

I am trying to do a transaction from the user but when I am trying to get the channel then I am getting this error:

Microservice Logs:

error: [DiscoveryService]: send[mychannel] - Channel:mychannel received discovery error:failed constructing descriptor for chaincodes:<name:"mychannel" >
createTransaction Error: Cannot do transaction in blockchain: DiscoveryService: mychannel error: failed constructing descriptor for chaincodes:<name:"mychannel" >
at FabricRepository.<anonymous> (/app/microservice/dist/services/blockchain-client.js:235:23)
at Generator.throw (<anonymous>)
at rejected (/app/microservice/dist/services/blockchain-client.js:6:65)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
POST /fabric-service/createTransaction 997.103

Peer Logs:

2020-10-20 20:23:54.218 UTC [discovery.endorsement] func1 -> DEBU d98 Endpoint: peer0.org2.com:7052, InternalEndpoint: , PKI-ID: 82f87b1ae00364c30ce6293dd804af5f81462b137b8e4d151580b9fcafa9b4c9, Metadata:  satisfies principal principal:"\n\013Org2MSP\020\003" 
2020-10-20 20:23:54.218 UTC [discovery.endorsement] func1 -> DEBU d99 Endpoint: peer0.org2.com:7052, InternalEndpoint: , PKI-ID: 82f87b1ae00364c30ce6293dd804af5f81462b137b8e4d151580b9fcafa9b4c9, Metadata:  doesn't satisfy principal principal:"\n\007Org2MSP\020\003"  : the identity is a member of a different MSP (expected Org1MSP, got Org2MSP)
2020-10-20 20:23:54.218 UTC [discovery] chaincodeQuery -> ERRO d9a Failed constructing descriptor for chaincode chaincodes:<name:"mychannel" > ,: no peer combination can satisfy the endorsement policy

Configtx:

    mychannel:
        Consortium: MyConsortium
        <<: *ChannelDefaults
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org1
                - *Org2
            Capabilities:
                <<: *ApplicationCapabilities

Overall if I am doing the same transaction from org1 Peer I am getting similar error at the peer both are failing. If I remove an organization from the consortium it is working from that org but not when both are there

Any idea how to resolve this??

3

There are 3 answers

1
Paradox On BEST ANSWER

So the problem was with the script to create anchor peer for the organization the error was leaking through bash. After adding anchor peers for both organizations things resolved, and I am able to do transactions.

1
Ta-seen Junaid On

The problem may be come from configtx.yaml, you have to place all the "MSPDir" properly and when you will give command, you have to set environment variable according to that "MSPDir".

0
Badr Bellaj On

Generally, this error occurs if the chaincode name used in the transaction doesn't match the name used when the chaincode is deployed into the network.

Sometimes this happens if the Chaincode isn't instantiated or isn't defined in the channel. It is better to inspect Docker containers to know about the reason behind this error and make sure that the chaincode names are the same(be aware of upper/lower cases) If you are running FB test network you can use

./monitordocker.sh fabric_test