HyperledgerHandsOn / trade-finance-logistics

Trade Finance and Logistics based on Letter of Credit and Proof of Shipment
Apache License 2.0
174 stars 1.49k forks source link

Issues in running curl commands for the application module #54

Closed kaliaanup closed 5 years ago

kaliaanup commented 5 years ago

Hi

I ran the following curl command

curl -s -X POST http://localhost:4000/channel/join -H "authorization: Bearer auth-token"

I am getting the following error.

{"success":false,"message":"Cannot read property 'stack' of undefined"}

When I checked the error I am getting the following. Am I missing something.

Joining channel tradechannel Successfully enrolled 'admin' user for org exporterorg Successfully got the genesis block error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: Cannot create ledger from genesis block, due to LedgerID already exists at /home/akkalia/go/src/trade-finance-logistics/middleware/node_modules/fabric-client/lib/Peer.js:114:16 at /home/akkalia/go/src/trade-finance-logistics/middleware/node_modules/grpc/src/client.js:586:7 Failed join attempt: TypeError: Cannot read property 'stack' of undefined at Client.newDefaultKeyValueStore.then.then.then.then (/home/akkalia/go/src/trade-finance-logistics/middleware/join-channel.js:205:61) at

VRamakrishna commented 5 years ago

It means that the peers have already joined the channel. Why were you retrying the command? The peer tried to instantiate another ledger with the same ID, so it threw an exception.

Can you read through the systems and protocol description in the book and try out the exercises while understanding the purpose of the different commands? Just pinging the application server with curl commands serves no purpose otherwise.

I agree that the application server could do with better error messaging, but there is a laundry list of ways in which Fabric can throw an exception, and handling each of them is a much longer exercise. The purpose of building the application server in this repo (and for the book) was just to demonstrate the most basic functionality. It is up to the reader to work on making that server more robust and user-friendly if they wish to.

kaliaanup commented 5 years ago

Hi Venkat

Thanks.

I am new to the whole Hyperledger fabric and hence, I was blindly following the instructions. As of now my observation is that the instructions are not intuitive. It still needs more clarifications.

Anyways now I can confirm my setup is complete.

Regards Anup

VRamakrishna commented 5 years ago

If you have any specific comments on the non-intuitiveness, state them here. At least it'll be in the records for people to see, and I can try to update the READMEs. Can't do anything about the contents of the book, I'm afraid. Perhaps if there's a future edition....