IBM/build-blockchain-insurance-app

error: [Peer.js]: sendProposal - timed out after:45000 error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: REQUEST_TIMEOUT

SailendraDs opened this issue · 27 comments

Error ->

/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: [Peer.js]: sendProposal - timed out after:45000
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: REQUEST_TIMEOUT
at Timeout._onTimeout (/app/node_modules/fabric-client/lib/Peer.js:124:19)
at ontimeout (timers.js:386:11)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)
Fatal error instantiating chaincode on some(all) peers!
Error: Proposal rejected by some (all) of the peers: Error: REQUEST_TIMEOUT
at /app/www/blockchain/utils.js:248:15

I tried all the Instructions in every thread here. Earlier it worked well when i have executed it last week but now i'm facing issues in this.

my DockerFile -
FROM docker.io/library/node:8.11.3

ENV NODE_ENV production
ENV PORT 3000
ENV DOCKER_SOCKET_PATH /host/var/run/docker.sock
ENV DOCKER_CCENV_IMAGE hyperledger/fabric-ccenv:x86_64-1.1.0

RUN mkdir /app
COPY . /app
WORKDIR /app
RUN apt update && apt install -y build-essential
&& npm i && npm i --only=dev
&& npm run build
&& npm prune
&& apt remove -y build-essential

EXPOSE 3000
CMD ["npm", "run", "serve"]

build_ubuntu,sh - File
#!/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

Versions -

  1. docker - 19.03.6 (Any Instructions, to downgrade to 18.09.6? Please share)
  2. docker-compose : 1.24.1
  3. Node - 8.11.3 (npm - 5.6.0)

Please let me know.. @horeaporutiu Sir

Fatal error instantiating chaincode on some(all) peers!
Error: Proposal rejected by some (all) of the peers: Error: REQUEST_TIMEOUT
at /app/www/blockchain/utils.js:248:15
at Generator.next ()
at step (/app/bin/blockchain/utils.js:102:191)
at /app/bin/blockchain/utils.js:102:361
at
at process._tickCallback (internal/process/next_tick.js:188:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 255
npm ERR! blockchain-for-insurance@2.1.1 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.1 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

ubuntu@ubuntu:~/build-blockchain-insurance-app$ docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
14f322147dde police-peer "peer node start" 4 minutes ago Up 3 minutes 0.0.0.0:10051->7051/tcp, 0.0.0.0:10053->7053/tcp police-peer
326e74efb6b2 repairshop-peer "peer node start" 4 minutes ago Up 3 minutes 0.0.0.0:9051->7051/tcp, 0.0.0.0:9053->7053/tcp repairshop-peer
2f31e6eaa9e3 shop-peer "peer node start" 4 minutes ago Up 3 minutes 0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp shop-peer
236715b8b5ce insurance-peer "peer node start" 4 minutes ago Up 3 minutes 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp insurance-peer
cc2caac9a0d0 repairshop-ca "fabric-ca-server st…" 4 minutes ago Up 3 minutes 0.0.0.0:9054->7054/tcp repairshop-ca
83f255872eb7 orderer "orderer" 4 minutes ago Up 3 minutes 0.0.0.0:7050->7050/tcp orderer0
f334172b2d6b insurance-ca "fabric-ca-server st…" 4 minutes ago Up 3 minutes 0.0.0.0:7054->7054/tcp insurance-ca
6372e858fc4d police-ca "fabric-ca-server st…" 4 minutes ago Up 3 minutes 0.0.0.0:10054->7054/tcp police-ca
c9b8505008ab shop-ca "fabric-ca-server st…" 4 minutes ago Up 3 minutes 0.0.0.0:8054->7054/tcp shop-ca

ubuntu@ubuntu:~/build-blockchain-insurance-app$ docker network ls

NETWORK ID NAME DRIVER SCOPE
44a7b1b86b4e bridge bridge local
fc6d163c8d31 build-blockchain-insurance-app_default bridge local
ed7c2cd3983b host host local
fdd438b6c972 none null local

Anyone who solved this. Please help out.
I followed all the instructions in other threads & nothing worked out.
Earlier when i tried for the first time it worked but again it showed up error.
Please let me know.
Thanks

Insurance Peer Logs are here
insurance-peer-logs.txt

I got this error, I used nvm to try different version combination to get it work. Following is my environment.

node 8.11.1
npm 5.6.0
nvm 0.35.3
docker 18.06.3-ce,
docker-compose 1.24.0

I think the node version is the most important one.

@david168 Mac or Ubuntu? Guessing Ubuntu.

It is causing in Ubuntu..
I tried every version described in every article like 8.11.1 then 8.6.3 then 8.11.3 (node versions) so on.
Even tried with docker 18.06 then 19.02 as well not worked at all
@horeaporutiu Sir Any Idea how to clear this error out. Please help. Thanks

I don't have ubuntu so will be hard for me to try this anytime soon..but since you said it worked earlier,

have you tried clearing your docker containers ?

docker stop $(docker ps -a -q) ; docker rm -f $(docker ps -aq) ; docker system prune -a ; docker volume prune ; docker ps -a ; docker images -a ; docker volume ls

yes sir. i cleared it. What are the actual versions of packages i need to use? like accurate. if u can suggest. I'll try it again

like Docker - v18.06
Docker-compose v1.24.0
Node - v8.11.1
Any latest i need to use? please let me know. will try again

@david168 Mac or Ubuntu? Guessing Ubuntu.

ubuntu 18.04 Desktop version

@SailendraDs @david168

  1. you've made sure to change the line in config.js to isUbuntu: true right?

  2. I've just tested this and it works on the following specs

OS: Ubuntu Linux 18.04 LTS Bionic Beaver Minimal Install (64 bit)

root@horea:/var/lib/build-blockchain-insurance-app# docker -v
Docker version 19.03.8, build afacb8b7f0
root@horea:/var/lib/build-blockchain-insurance-app# docker-compose -version
docker-compose version 1.17.1, build unknown

You may also want to check this troubleshooting tip - i.e. if you get this error:


Peer joined default channel
Connecting and Registering Block Events
Chaincode is not installed, attempting installation...
Base container image present.
Successfully installed chaincode on the default channel.
2019-06-18T17:56:22.641Z - error: [Peer.js]: sendProposal - timed out after:45000
Fatal error instantiating chaincode on some(all) peers!
Error: Proposal rejected by some (all) of the peers: Error: REQUEST_TIMEOUT
at /app/www/blockchain/utils.js:243:15
at Generator.next ()
at step (/app/bin/blockchain/utils.js:103:191)
at /app/bin/blockchain/utils.js:103:361
at
at process._tickCallback (internal/process/next_tick.js:188:7)
npm ERR! code ELIFECYCLE

Go ahead and change the Dockerfile in the /web directory to the following:

FROM docker.io/library/node:8.9.0
ENV NODE_ENV production
ENV PORT 3000
ENV DOCKER_SOCKET_PATH /host/var/run/docker.sock
ENV DOCKER_CCENV_IMAGE hyperledger/fabric-ccenv:latest
RUN mkdir /app
COPY . /app
WORKDIR /app
RUN npm i && npm i --only=dev \
&& npm run build \
&& npm prune
EXPOSE 3000
CMD ["npm", "run", "serve"]

After you change the dockerfile, run the ./clean script, and then docker login, and then try and run the ./build_ubuntu script again.

You can read more about this issue here

Please let me know if this solves it.

If this does not solve it - i would clean all docker containers using the following command

docker stop $(docker ps -a -q)  ; docker rm -f $(docker ps -aq) ; docker system prune -a ; docker volume prune ; docker ps -a ; docker images -a ; docker volume ls

remove the repo, clone it again, and run through the steps again.

Keep me updated.

@SailendraDs

node is not installed on the machine.

root@MarkStur1:~/build-blockchain-insurance-app# node -v

Command 'node' not found, but can be installed with:

apt install nodejs

root@MarkStur1:~/build-blockchain-insurance-app# 

Docker installs node in the script - https://github.com/IBM/build-blockchain-insurance-app/blob/master/web/Dockerfile - and it uses 8.11-stretch as shown in the file here.

Here is the OS i have tested on - and it works fine.

root@MarkStur1:~/build-blockchain-insurance-app# hostnamectl
   Static hostname: MarkStur1.fyre.ibm.com
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 428e44fb1ec74efba5d4e3ca11fa2ac9
           Boot ID: 59c8fcd9238645e1b56c6232095e60e6
    Virtualization: kvm
  Operating System: Ubuntu 18.04.4 LTS
            Kernel: Linux 4.15.0-76-generic
      Architecture: x86-64
root@MarkStur1:~/build-blockchain-insurance-app# 
root@MarkStur1:~/build-blockchain-insurance-app# docker -v
Docker version 19.03.8, build afacb8b7f0
root@MarkStur1:~/build-blockchain-insurance-app# docker-compose --version
docker-compose version 1.17.1, build unknown

With these docker version and docker-compose, it worked on my Ubuntu OS as shown above.

@horeaporutiu
It didn't work.
I followed the same docker -v
Docker version 19.03.8, build afacb8b7f0
docker-compose -v
docker-compose version 1.17.1, build unknown
Docker File is updated when first time it didn't work. to 8.9.0
1

Cleared Containers & Everything as said.

I'm Using Ubuntu 18.04.4 Bionic Beaver on VMware
I changed 3 files, 1. Dockerfile, 2.www/blockchain/config.js to isubuntu: true,3. peer-base.yaml network to buildblockchaininsuranceapp_default
Still I'm not sure where it is going wrong.

@horeaporutiu It worked for 8-9 seconds & the got not found with an error Timed out after 45000 unlike earlier, it didn't even run for 1 second.

  • Okay, I have this configuration running actually and it works!.
  • [ ]
  • Working with this versions:
  • ----------------------------------------------------------
  • jdiaz@ubuntu:~$ docker --version
  • Docker version 19.03.8, build afacb8b7f0
  • jdiaz@ubuntu:~$ docker-compose --version
  • docker-compose version 1.25.5, build 8a1c60f6
  • jdiaz@ubuntu:~$ node -v
  • v14.2.0
  • jdiaz@ubuntu:~$ npm -v
  • 6.14.4
  • jdiaz@ubuntu:~$ nvm --version
  • 0.35.3
  • ---------------------------------------------------------
  • [ ]
  • Then, you need modify this 3 archives:
  • [ ]
  • -------------------------------------------------------------------------------------------------------------
  • 1. config.js file (route : build-blockchain-insurance-app/web/www/blockchain/)
  • Change line 9 of of build-blockchain-insurance-app/web/www/blockchain/config.js file to isUbuntu: true
  • 2. Dockerfile (route: build-blockchain-insurance-app/web/)
  • [ ]
  • FROM docker.io/library/node:8.9.0
  • ENV NODE_ENV production
  • ENV PORT 3000
  • ENV DOCKER_SOCKET_PATH /host/var/run/docker.sock
  • ENV DOCKER_CCENV_IMAGE hyperledger/fabric-ccenv:latest
  • RUN mkdir /app
  • COPY . /app
  • WORKDIR /app
  • RUN npm i && npm i --only=dev \
  • && npm run build \
  • && npm prune
  • EXPOSE 3000
  • CMD ["npm", "run", "serve"]
  • [ ]
  • 3. peer-base.yml (route: build-blockchain-insurance-app/ )
  • [ ]
  • version: '2'
  • services:
  • peer-base:
  • environment:
  • - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
  • - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=build-blockchain-insurance-app_default
  • - CORE_LOGGING_LEVEL=DEBUG
  • - CORE_PEER_TLS_ENABLED=true
  • - CORE_PEER_ENDORSER_ENABLED=true
  • - CORE_PEER_GOSSIP_USELEADERELECTION=true
  • - CORE_PEER_GOSSIP_ORGLEADER=false
  • - CORE_PEER_PROFILE_ENABLED=true
  • - CORE_PEER_MSPCONFIGPATH=/peer/crypto/msp
  • - CORE_PEER_TLS_CERT_FILE=/peer/crypto/tls/server.crt
  • - CORE_PEER_TLS_KEY_FILE=/peer/crypto/tls/server.key
  • - CORE_PEER_TLS_ROOTCERT_FILE=/peer/crypto/tls/ca.crt
  • working_dir: /peer
  • command: peer node start
  • volumes:
  • - /var/run/:/host/var/run/
  • ------------------------------------------------------------------------------------------------------------
  • NOTE:
  • - I have installed node v14.2.0, but in Dockerfile i put v8.9.0 (it installa that version for dockerfile), not necesary installed on local virtual machine.
  • - In peer-base.yml, i have this line :
  • CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=build-blockchain-insurance-app_default
  • I have the name "build-blockchain-insurance-app_default" without changes, my docker version do not have problems with characters '-', in older versions you need change "build-blockchain-insurance-app_default" by "buildblockchaininsuranceapp_default" (remove '-').
  • - FOR peer-base.yml DO NOT FORGET RESPECT SYNTAX, REMEMBER THAT IS A .yml FILE.
  • ------------------------------------------------------------------------------------------------------------
  • [ ]
  • Finally:
  • If you are ok with all the file changed, run this commands:
  • [ ]
  • jdiaz@ubuntu:~/build-blockchain-insurance-app$ docker image prune
  • jdiaz@ubuntu:~/build-blockchain-insurance-app$ systemctl restart docker
  • jdiaz@ubuntu:~/build-blockchain-insurance-app$ docker login
  • jdiaz@ubuntu:~/build-blockchain-insurance-app$ ./build_ubuntu.sh
  • jdiaz@ubuntu:~/build-blockchain-insurance-app$ docker logs web
  • [ ]
  • ;)

I tried remove IMB logo with fails too, but i use tricks for remove logo, the logo is painted with black lines, then you can change the color black for white, you need change this file:

For Header:

  1. northstar.css (route : build-blockchain-insurance-app/web/src/)
    In this file search "#ibm-home a{box-sizing:border-box;". Look inside the file, the code range between "#ibm-home a{box-sizing:border-box;" AND "ibm-parent-site-name a:hover", change all the tags "color:#000" By "color:#e0e0e0".
    With this changes you are painting the logo with BLANK COLOR, same to the background, and the logo dissapears.

For Footer:
2. _layout.pug (route: build-blockchain-insurance-app/web/views/)
In this file replace only FOOTER section by this code.

footer
        .ibm-col-5-1
            h3.ibm-bold Seleccionar el Idioma:
            select#region-selector(style='width: 100%;')
              option(value='', selected)  
              option(value='en') Ingles
              option(value='de') Español

Good Luck!

@josecarlos3390
there's an issue with the header part even if i change the color to e0e0e0. it shows blue colored ibm logo. I'm also looking for other solution. will share if i get it.