0

I am working composer v0.16.2. I am having an error while I try to reconnect to composer-rest-server.

I am using this command:

composer-rest-server -c admin@mynetwork -n always -a true -m true -w true -t true -e /home /.nvm/versions/node/v8.9.3/lib/node_modules/composer-rest-server/cert.pem -k /home /.nvm/versions/node/v8.9.3/lib/node_modules/composer-rest-server/key.pem

Whatever the option I set it works fine first time but when I need to reconnect with the same command, I need to restart fabric and deploy the business network again otherwise it will show this error:

Discovering types from business network definition ...
Connection fails:
Error: Error trying to ping.
Error: Error trying to query business network.
Error: Connect Failed It will be retried for the next request.
Exception: Error: Error trying to ping.
Error: Error trying to query business network.
Error: Connect Failed Error: Error trying to ping.
Error: Error trying to query business network.
Error: Connect Failed at _checkRuntimeVersions.then.catch (/home/.../.nvm/versions/node/v8.9.1/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:713:34)
                      at <anonymous>

Hyperledger Composer v0.16.0 network start error

I found a similar question on this link but I need to start fabric again when this error comes and again deploying network archive help to start the rest server.

My question is how can I remove this error without starting fabric again when I need to start rest server?

  • There is not really enough information here - what command did you use? What are your steps leading up to the error? Are you using samples/tutorials or your own Business Network? Has your Business Network been deployed? Is your Fabric started? Have you seen the answer to this post which describes checking and starting a Development Fabric? https://stackoverflow.com/questions/47767190/hyperledger-composer-error-identity-has-not-been-registered-once-issued-after-re – R Thatcher Dec 19 '17 at 11:45
  • I am using composer-rest-server to create a rest server on my own business network. @RThatcher – Rajat Wasan Dec 19 '17 at 11:50
  • what output do you get if you do composer-rest-server -v ? what output do you get when you do composer -v ? – david_k Dec 19 '17 at 12:50
  • @david_k v0.16.2 for both composer -v as well as composer-rest-server -v – Rajat Wasan Dec 20 '17 at 08:31

1 Answers1

0

The first action of the REST server is to 'Discover' the Business Network using the admin@mynetwork Card. So you can simplify testing here by not using the REST server, but by issuing a simpler command composer network ping -c admin@mynetwork or composer network list -c admin@mynetwork.

When your admin@mynetwork card is created (when you deploy the business network), then imported BEFORE you use it try the command composer card list --name admin@mynetwork - at the bottom of the output you should see:

secretSet: Secret set credentialsSet: Credentials not set

After you use the card for the first time with a composer network ping or list, redo the composer card list --name admin@mynetwork and you should see a change in the output with Credentials set.

This is important because when the Card is created, it is created with a One Time secret, and when it is first used the Certificates are downloaded - Credentials Set. The problem you are seeing with a failure of the REST server the second time you use it suggests that the certificates needed for the second use are not present.

R Thatcher
  • 5,455
  • 1
  • 5
  • 15