Hyperledger Fabric version: 2.2.4
Fabric Client: Fabric-Tools 2.2 Docker Image - https://hub.docker.com/layers/hyperledger/fabric-tools/2.2/images/sha256-a5f691808466e90942af3f5f72d697cdaa4e545acfc1f645a553986423ef7ea5?context=explore
Chaincode: Fabric-samples Javascript
Context on the issue:
I am currently creating a CI/CD pipeline for the deployment of chaincode using the 2.x chaincode lifecycle. I am facing unexpected behavior with Node.js chaincode deployment whereby the node_modules I install using npm install prior to running peer lifecycle chaincode package
(per the documentation) are not included in the resulting tar.gz package within code.tar.gz. Because my peer nodes are not able to access the internet to install dependencies, the missing modules result in errors when running the chaincode after installation. More specifically, I get errors related to missing modules like Fabric Shim which are defined in require()
statements in the chaincode sample.
When manually deconstructing unpacking the tar.gz structure, the code.tar.gz archive does not include node_modules that are present in the target chaincode directory that I defined the path to in the peer lifecycle chaincode package
command.
Expected Behavior: My understanding was that the new chaincode lifecycle packaging process included the dependencies in the tar.gz package before deploying and therefore there is no need to run npm install or otherwise download dependencies from externally at runtime. More specifically, based on the documentation and examples online, it seems the peer lifecycle chaincode package command would include installed dependencies from node_modules in the package for deployment.
Is this not the default behavior of the chaincode packaging mechanism, and if not, is there a best practice for bundling dependencies on Node.js chaincode where npm install
at the peer is not possible?
TIA for any help here