Search code examples
typescripthyperledger-fabricsmartcontractschaincode

TypeScript chaincode invocation is failing from fabric samples


When i run the test-network from fabric samples 2.2 and try to install and invoke the typescript chaincode for fabcar. From the packaging to commit stage everything runs smoothly but on invocation it gives me error and the docker container exits.

these are the commands i input: ./network.sh up ./network.sh createChannel ./network.sh deployCC -ccn basic -ccl typescript -ccp /home/ubuntu/fabric/hlf/fabric-samples/chaincode/fabcar/typescript -cci initLedger last output after running the final command docker logs for the exited container


Solution

  • I think you are seeing this bug, which seems to be caused by a regression in a dependency (@grpc/[email protected]):

    https://github.com/hyperledger/fabric-chaincode-node/issues/372

    [email protected] seems to fix this by pinning to a specific known good dependency version:

    https://github.com/hyperledger/fabric-chaincode-node/releases/tag/v2.5.1

    Depending on how you have specified the fabric-shim dependency in your chaincode, just re-deploying may be enough to solve the problem. Alternatively, you can update your fabric-shim dependency to make sure you pick up v2.5.1.

    I notice that grpc-js has now published v1.8.3. I don't know whether that resolves the regression in v1.8.2.