1
votes

I am testing a a business network I created, I ran the Composer-rest-server and all worked fine, then shut the server as suggested in the developers guide , then I proceeded use the yo hyperledger composer to create the skeleton of the angular app, however, now the angular app is showing in the local browser, however, the composer-rest- server is not.

Expected Behavior: I should start the composer-rest- server in localhost:3000 and the angular app as well

Actual Behavior:

I get this message; scovering types from business network definition ... Connection fails: Error: Error trying to ping. Error: Error trying to query chaincode. Error: Connect Failed It will be retried for the next request. Exception: Error: Error trying to ping. Error: Error trying to query chaincode. Error: Connect Failed Error: Error trying to ping. Error: Error trying to query chaincode. Error: Connect Failed at _checkRuntimeVersions.then.catch (/home/node/.nvm/versions/node/v6.11.2/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:696:34)

Your Environment [email protected] [email protected] [email protected] Docker version 17.06.0-ce, build 02c1d87 docker-compose version 1.13.0, build 1719ceb

2

2 Answers

0
votes

The Problem

If you kill your fabric instance using ./stopFabric that you started using the ./startFabric command then all the containers that were apart of the business network were killed as well and therefore you need to reinstall the .bna and start the network again. (the development flow provided is purposely volatile for rapid development)

The Solution

1.) Type docker ps to see all of your running containers. You should see none if you are getting that error because your peer is not responding to pings

2.) Open a separate terminal and navigate to where you have fabric-dev-servers in the terminal and run ./fabricStart. This will start all the containers like your network Certificate Authority, the peer, the orderer, etc.

3.) Return to your project in another terminal. Do Step 1 & 2 found at the developer tutorial (you likely won't need to do step 3 since you likely already imported the network administrator identity going through the tutorial)

4.) Run composer network ping --card admin@tutorial-network. The ping should go through.

5.) Run docker ps. You should see 4 containers running

6.) Run composer-rest-server and follow the steps from the tutorial.

7.) Run cd tutorial-network-app to switch to where your angular application is (or wherever you generated it with the yo command)

8.) Navigate to http://localhost:3000 and everything should work.

Any other questions or problems just reply here and I can help.

0
votes

The expected behaviour is that the REST server is already running (the the generator uses Loopback to spin up a REST server already (that's why you shut down the previous REST server)). Its described here https://hyperledger.github.io/composer/unstable/tutorials/developer-guide.html under 'Generate your Skeleton Web Application'.

After you created the application - following completion of the yo hyperledger-composer questions (and after providing the answers) you run your application using npm start from within the generated application directory. Your app is accessible at http://localhost:4200.