I am working with hyperledger-fabric on amazon managed blockchain. There I have written the chaincode with node.js. The problem is, the dependencies I'm using is not supported in amazon managed blockchain's peer. That's why I need to bundle my chaincode with the node modules. How can I do tha?
How Can I bundle a simple node.js application
266 Views Asked by Khandker Tanvir Hasan At
1
There are 1 best solutions below
Related Questions in AMAZON-MANAGED-BLOCKCHAIN
- AWS AMB Private network connection with Hardhat
- Suppressed: java.lang.UnsatisfiedLinkError: no io_grpc_netty_shaded_netty_tcnative in java.library.path
- Chain ID for connecting AWS private Ethereum Blockchain with Metamask
- Can't invoke nodejs chaincode on Hyperledger Fabric - Amazon Managed Blockchain
- Error: failed to normalize chaincode path: 'go list' failed with: Use -buildvcs=false to disable VCS stamping.: exit status 1
- Error: Response from server: Error Code: 20 - Authentication failure - Amazon Managed Blockchain
- Unable to enroll Fabric client as admin - Amazon Managed Blockchain
- Error getting endorser client for channel: failed to create new connection: context deadline exceeded
- Issue connecting my lambda function to Amazon managed blockchain
- How to get query transaction id from AWS managed blockchain using chaincode
- How Can I bundle a simple node.js application
- Error creating peer channel Amazon Managed Blockchain Hyperledger Fabric v1.4
- AWS managed hyperledger fabric v1.4.7 blockchain - Getting bad certificate error when connecting to the fabric network
- AWS Etheruem Node Websocket Connection Keeps CLosing
- Whats the first step in creating a blockchain based certification system?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Here are steps for bundling Node.js chaincode with external dependencies on Amazon Managed Blockchain Hyperledger Fabric 2.2 networks:
Why bundling is needed: Due to stringent security requirements, peer nodes in Amazon Managed Blockchain do not have access to the open internet. This means that peer nodes cannot download external dependencies at runtime when building/executing chaincode. If you suspect missing node_modules/ are responsible for errors in your chaincode, you can verify this by viewing Chaincode logs in Amazon CloudWatch, where reference to missing node_modules / dependencies will be clearly evident.
How to bundle dependencies First, navigate to the root directory of the chaincode you wish to deploy. Your package.json file should be present in this directory. From this directory, run
npm ito install node_modules. Then, move those node_modules to a new directory -- Example:Moving the dependencies to
lib/will allow you to package the installed NPM packages (dependencies) in the chaincode tar.gz file in the following steps. Because the node_modules are stored inlib/, the Node.js start script inpackage.jsonhas been modified slightly to tell the container environment that runs the chaincode where to find the dependencies at runtime:"start": "NODE_PATH=lib node <entrypoint filename>.js"With the node_modules bundled in
lib/and the start script for the chaincode modified to point to those node_modules, one can now package, install, approve and commit this chaincode as normal using the Chaincode Lifecycle commands.