0

Background

I am currently studying Hyperledger Fabric. So I installed the prerequisites on my local and tried to follow this tutorial about fabcar.

Problem

Everything went well until I ran node query.js, which returned this error:

Store path:/home/me/fabric-samples/fabcar/hfc-key-store
Successfully loaded user1 from persistence
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: 14 UNAVAILABLE: Connect Failed
    at new createStatusError (/home/me/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/src/client.js:64:15)
    at /home/me/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/src/client.js:583:15
Query has completed, checking results
error from query =  { Error: 14 UNAVAILABLE: Connect Failed
    at new createStatusError (/home/me/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/src/client.js:64:15)
    at /home/me/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/src/client.js:583:15
  code: 14,
  metadata: Metadata { _internal_repr: {} },
  details: 'Connect Failed' }

Solution Attempts

I have tried following the answers to similar problems, especially this one: Hyperledger fabcar sample fabric showing connect failed ERROR.

So I ran ifconfig (after removing all containers):

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:b3:67:1a:ec  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp1s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether c8:d3:ff:25:43:ff  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 282  bytes 24402 (24.4 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 282  bytes 24402 (24.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.30  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::99eb:462:7866:d63  prefixlen 64  scopeid 0x20<link>
        ether 30:e3:7a:2c:4d:ae  txqueuelen 1000  (Ethernet)
        RX packets 419  bytes 86802 (86.8 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 391  bytes 64650 (64.6 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

I then replaced localhost with 192.168.1.30 in query.js:

var peer = fabric_client.newPeer('grpc://192.168.1.30:7051');

and invoke.js:

var peer = fabric_client.newPeer('grpc://192.168.1.30:7051');
var order = fabric_client.newOrderer('grpc://192.168.1.30:7050')
event_hub.setPeerAddr('grpc://192.168.1.30:7053');

I did everything from the start again, but it produced the same error when querying the cars.

I have also tried the solution here, but there is no proxy line in my bashrc so there is nothing to comment off.

Any help is appreciated.

Other Info

OS: Ubuntu 18.04

npm version: 6.14.1

docker ps -a:

CONTAINER ID        IMAGE                        COMMAND                  CREATED              STATUS                          PORTS                                        NAMES
63e05790822a        hyperledger/fabric-peer      "peer node start"        About a minute ago   Exited (2) About a minute ago                                                peer0.org1.example.com
5c0403f2016c        hyperledger/fabric-orderer   "orderer"                About a minute ago   Up About a minute               0.0.0.0:7050->7050/tcp                       orderer.example.com
b3875081b310        hyperledger/fabric-couchdb   "tini -- /docker-ent…"   About a minute ago   Up About a minute               4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp   couchdb
710379df45ac        hyperledger/fabric-ca        "sh -c 'fabric-ca-se…"   About a minute ago   Up About a minute               0.0.0.0:7054->7054/tcp                       ca.example.com
CH123
  • 251
  • 1
  • 5
  • 15

1 Answers1

0

Since I didn't know what else to do, I removed everything and started from scratch again, this time using the latest fabric-samples release (I didn't realize I was using an older version before). It worked smoothly after that, i.e., no errors were encountered.

CH123
  • 251
  • 1
  • 5
  • 15