ialberquilla / hlf1.4-supply-chain

Supply chain proof of concept in Hyperledger Fabric. Network with four companies and a specific chaincode exposed as rest API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting error during Instanciating the chaincode

sudhir512kj opened this issue · comments

Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: API error (404): network supplynetwork_byfn not found
Screenshot from 2020-08-13 11-25-58
Screenshot from 2020-08-13 11-25-48

This error I am getting in Instantiating the chaincode

Can confirm

@sudhir512kj There is a typo in supply-network/base/peer-base.yaml, in line 16:

- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=supplynetwork_byfn

but it should be:

- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=supply-network_byfn

You may also want to change:
supply-network/scripts/start.sh: Set export IMAGE_TAG=latest to export IMAGE_TAG=1.4.3

For some reason, in the installation process hyperledger/fabric-ccenv:latest is downloaded anyway. This will also block your chain from being installed correctly. You can do a workaround by pulling the 1.4.3 version of that docker image and renaming it to latest as follows:

docker pull hyperledger/fabric-ccenv:1.4.3
docker tag hyperledger/fabric-ccenv:1.4.3 hyperledger/fabric-ccenv:latest

After this, run ./network.sh start and you should be fine. I'm creating a merge request later on.

That error is fixed. Now I am getting this when I do call the API
E1022 21:13:34.101968255 223560 ssl_transport_security.cc:1238] Handshake failed with fatal error SSL_ERROR_SSL: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed.

Thank you. It's resolved.

Hello @eXsiLe95 Sir,
I am getting this error when I do call getTuna API
"message":"transaction returned with failure: ReferenceError: sassetAsBytes is not defined","stack":"Error: transaction returned with failure: ReferenceError: sassetAsBytes is not defined

Have a look at the merge request and check that version out. It should be fixed there.
For your very problem: See file chaincode/lib/supplyChain.js at line 21. There is a typo sassetAsBytes which should be assetAsBytes as you might have guessed.

Hello @eXsiLe95 , After fixing all typos that you fixed in that PR, I again did ./network stop and then ./network start, it works and started. And then I called /addTuna it success, but when I /getTuna/10001 it gives an error that
sassetAsBytes is not defined still after fixing that typo mistake of assetAsBytes

Since you made changes to your chaincode, you need to install it again.

./network.sh stop
./network.sh install
./network.sh start

still not resolved. I got some error during ./network.sh install. Is it possible due to this?
Screenshot from 2020-10-23 17-42-05

Hello @eXsiLe95 , I am also getting this warning during ./network.sh stop
WARNING: The IMAGE_TAG variable is not set. Defaulting to a blank string.

I can not help you with that since the error that occurred is further up than your terminal shows.

Also, I can not help you with every step to get that project running. I stumbled upon the same errors you did, I fixed them. If your primary goal is to get this project up and running, I recommend you check out the branch of the Pull Request I created and go through the README step by step. If you already made changes to the project (which I doubt since it did not run), copy them over later.

For the warning you receive: As far as I would think, the stop command also requires an IMAGE_TAG environmental variable which does not seem to be set. Just take a brief look into the network.sh script and you will get there.

@sudhir512kj Have you installed node-gyp?

sudo apt install node-gyp

You need it to compile the chaincode correctly

Hello @eXsiLe95, Thank you for your guidance. I have resolved the issues. It is working fine now. Actually, I had to use the Node 11 version or fewer to run node-gyp. It is working now. But I am having some small issues. One is that I am getting time out during starting chaincode supcc:1.0 for the transaction and the other is that - querySushi function is not defined in the code. If that is really an issue, please assign it to me, I would like to work on it. Guide me on it. Thank you.
Note:- This time out issue happens sometimes only.