build-blockchain-insurance-app: error: [client-utils.js]: sendPeersProposal - Promise is rejected

first time after a start, site working fine but after few minutes i get errors and site stop a work

sudo docker logs web npm info it worked if it ends with ok npm info using npm@3.10.10 npm info using node@v6.11.3 npm info lifecycle blockchain-for-insurance@2.1.0~preserve: blockchain-for-insurance@2.1.0 npm info lifecycle blockchain-for-insurance@2.1.0~serve: blockchain-for-insurance@2.1.0

blockchain-for-insurance@2.1.0 serve /app cross-env NODE_ENV=production node ./bin/server

/app/app/static/js Server running on port: 3000 Default channel not found, attempting creation… Successfully created a new default channel. Joining peers to the default channel. Chaincode is not installed, attempting installation… Base container image present. info: [packager/Golang.js]: packaging GOLANG from bcins info: [packager/Golang.js]: packaging GOLANG from bcins info: [packager/Golang.js]: packaging GOLANG from bcins info: [packager/Golang.js]: packaging GOLANG from bcins Successfully installed chaincode on the default channel. error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: 2 UNKNOWN: error starting container: API error (404): {“message”:“network buildblockchaininsuranceapp_default not found”}

at new createStatusError (/app/node_modules/grpc/src/client.js:64:15)
at /app/node_modules/grpc/src/client.js:583:15

Fatal error instantiating chaincode on some(all) peers! Error: Proposal rejected by some (all) of the peers: Error: 2 UNKNOWN: error starting container: API error (404): {“message”:“network buildblockchaininsuranceapp_default not found”}

at /app/www/blockchain/utils.js:248:15
at next (native)
at step (/app/bin/blockchain/utils.js:102:191)
at /app/bin/blockchain/utils.js:102:361

npm info lifecycle blockchain-for-insurance@2.1.0~serve: Failed to exec serve script npm ERR! Linux 4.8.0-49-generic npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “run” “serve” npm ERR! node v6.11.3 npm ERR! npm v3.10.10 npm ERR! code ELIFECYCLE npm ERR! blockchain-for-insurance@2.1.0 serve: cross-env NODE_ENV=production node ./bin/server npm ERR! Exit status 255 npm ERR! npm ERR! Failed at the blockchain-for-insurance@2.1.0 serve script ‘cross-env NODE_ENV=production node ./bin/server’. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the blockchain-for-insurance package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! cross-env NODE_ENV=production node ./bin/server npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs blockchain-for-insurance npm ERR! Or if that isn’t available, you can get their info via: npm ERR! npm owner ls blockchain-for-insurance npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! /app/npm-debug.log

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 24 (2 by maintainers)

Most upvoted comments

i do as the following steps and it works for me:

  • input “docker network ps” to figure out the name of the network( it is “buildblockchaininsuranceapp_default” for me)

  • go to ./peer-base.yaml and change CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE to the corresponding network name.

  • input"./clean.sh" to clean the docker containers and rebuild the app again

hope it works for u all too. and thank you for your help @lll2657

Before solving these issues, please use ./clean.sh first to clean your docker containers.

Join Peer Issue

Symptoms: Stuck inJoining peers to the default channel. Timeout: error: [Peer.js]: sendProposal - timed out after:45000 (node:21) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'map' of undefined

The reason for the issue is that the peers fail to join the channel because they are not ready to be used by the callback function in joinChannel() in ./web/www/blockchain/utils.js. In order to fix this, we need to separate the functions in the line docker-compose up -d, so that the containers are built and waited long enough for all the peers to be ready.

So all you need to do is to change build_ubuntu to the code below (similarly for build_mac):

#!/bin/bash
cp ./binary_ubuntu/* .
export FABRIC_CFG_PATH=$PWD
sh ./ibm_fabric.sh
sh ./docker-images.sh
sleep 5
docker-compose up --no-start
sleep 60
docker-compose up -d

Network not found Issue

Symptoms: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: 2 UNKNOWN: error starting container: API error (404): {"message":"network build-blockchain-insurance-app_default not found"}

The reason for the issue is that the network name cannot be found. To solve this, run docker network ls to figure out what the actual network name is, such as “buildblockchaininsuranceapp_default”. Go to ./peer-base.yaml and change CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE to the corresponding network name. Clean the docker containers with ./clean.sh and then rebuild the app again.

@lll2657 your solution worked. now its up & running.