error: [Orderer.js]: sendBroadcast - on error: "Error: 14 UNAVAILABLE:.. Hyperledger Caliper - hyperledger-fabric

I have setup hyperledger fabric version 1.4.2 with 1 org 2 peers 1 orderer setup all are running in 3 different VMs natively. Now I am trying to implement caliper v0.3.0 in this fabric setup. Peers and Orderer are already up and peers are joined in the channel. I have modified the network config file and benchconfig file in caliper according to my network. So I directly run the caliper using the flag "caliper-flow-only-install". While executing this, I am facing issues like
error: [Orderer.js]: sendBroadcast - on error: "Error: 14 UNAVAILABLE: failed to connect to all addresses\n at Object.exports.createStatusError (/home/xx/caliper-benchmarks/node_modules/grpc/src/common.js:91:15)\n at ClientDuplexStream._emitStatusIfDone (/home/xx/caliper-benchmarks/node_modules/grpc/src/client.js:233:26)\n at ClientDuplexStream._receiveStatus (/home/xx/caliper-benchmarks/node_modules/grpc/src/client.js:211:8)\n at Object.onReceiveStatus (/home/xx/caliper-benchmarks/node_modules/grpc/src/client_interceptors.js:1306:15)\n at InterceptingListener._callNext (/home/xx/caliper-benchmarks/node_modules/grpc/src/client_interceptors.js:568:42)\n at InterceptingListener.onReceiveStatus (/home/xx/caliper-benchmarks/node_modules/grpc/src/client_interceptors.js:618:8)\n at /home/xx/caliper-benchmarks/node_modules/grpc/src/client_interceptors.js:1123:18"
2020.04.29-12:22:12.094 error [caliper] [caliper-engine] Error while performing "install" step: Error: Orderer error for instantiating W1CC#v0 in composerchannelrest: SERVICE_UNAVAILABLE

It seems the issue is with using incorrect docker container port mapping.
Use the host port rather docker container port.
You can even cross check connection to container with network utility.
For instance, nc -vz [host] [port]
Hope this resolves SERVICE_UNAVAILABLE error.

Related

not able to invoke/query chaincode usin fabric Node SDK

I have created a sample HLF network with 3 organizations. I have taken an orderer and a peer from each organization ( total 3 orderers, 3 peers, 3 fabric-CA, 3 CouchDB instances).
I have successfully created the certificates, system channel, channel configuration, application channel and also successfully deployed the chaincode on each peer.
I am able to invoke/query any chaincode using peer binary in docker cli but not able to invoke/query the same chaincode through fabric Node SDK.
I have created the connection profile as per the template provided in the test network and also able to register any user for a specific organization. But whenever I am trying to query any chaincode function I am getting the below error:
[ServiceEndpoint]: Error: Failed to connect before the deadline on
Committer- name: orderer.example.com:7050, url:grpcs://localhost:7050,
connected:false, connectAttempted:true [ServiceEndpoint]: waitForReady
Failed to connect to remote gRPC server orderer.example.com:7050 url:grpcs://localhost:7050 timeout:3000
When I check the orderer logs I found this error:
ServerHandshake -> ERRO 087 Server TLS handshake failed in 2.085859ms
with error EOF server=Orderer remoteaddress=172.23.0.1:45678
**Why I am getting this error?
I am trying to just query so why it's connecting to the orderer?
If there is any TLS issue then why I am able to query it through peer binary?**
This link might help Hyperledger Fabric CA releasing wrong certificates (wrong issuer) to Node SDK when TLS enabled
If you are not running as a test network on your local machine, then you will need to specify the connection option of discovery.asLocalhost as false

orderer and peer container are exited after a few seconds run ./network.sh up and then i can't create channel

I followed the Official Fabric Test Network tutorial "Using the Fabric Test Network ", but reported some errors when I run ./network.sh createChannel. Log and errors like this:
Error: failed to create deliver client for orderer: orderer client
failed to connect to localhost:7050: failed to create new connection:
connection error: desc = "transport: error while dialing: dial tcp
127.0.0.1:7050: connect: connection refused"
Orderer and peer container are exited after a few seconds after i launch the network.sh and then i cant't create channel. I don't understand why.

Hyperledger Fabric, javascript fabcar chaincode error. Transport: error while dialing: dial tcp 127.0.0.1:7051: connect: connection refused

I am having the same problem with Hyperledger fabric 2.1.1, but I am able to run test network with default options, but when I try to run Fabcar javascript chaincode I get an error:
Error: error getting endorser client for channel: endorser client failed to connect to localhost:7051: failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp 127.0.0.1:7051: connect: connection refused"
I have tried everything mentioned in thread Error deploying Fabric test-network fabcar chaincode, removed docker images, ran prune, removed organizations data and fired ./network.sh up createChannel -ca -c mychannel -s couchdb -i 2.1.1, but the error is still there. Also, my RAM is 16Gb, so the problem is not there. Any other suggestion, please ?
This situation is happened because you called a gRPC to 127.0.0.1:7051 server but your call failed to hit the server. This situation may happen for many reasons, but for most of the cases the situation is happened due to server down(server exit or down due to misconfiguration) or for wrong certificate or your call failed to hit the server due to misconfiguration.
Please check the following docker container and ensure that is running properly.

I'm trying to instantiate a chaincode wriiten in node.js on the hyperledger fabric but I'm getting error

I installed the chaincode on the network but when I'm trying to instantiate,
I'm getting :
"Error: error getting broadcast client: orderer client failed to connect to 127.0.0.1:7050: failed to create new connection: context deadline exceeded"
Also, I tried to add TLS but then I get the following error:
Error: error getting broadcast client: failed to load config for OrdererClient: unable to load orderer.tls.rootcert.file:
And, the orderer logs are:
My orderer TLS is enabled now:
I'll be glad if someone can help or guide me atleast, I'm new to HyperledgerFabric.Thank you.
Adapt to your case:
peer chaincode instantiate -n mychannel -v 1.0 -C petshop -c '{"Args":[""]}' -o 127.0.0.1:7050 --tls --cafile /path/to/orderer/tls/ca.pem
Check the "orderer" logs precisely at the time you are instantiating the chaincode (first without TLS and then with TLS). You can see that time from your command-line when you are running that command.
Update your question with that section of orderer logs.
Also, if I need to guess from your current orderer nodes, you might not have enabled TLS for the orderer container.

Endorsement fails when node.js fabric-client application is run on a separate node

I'm running the fabcar example from fabric samples on a node. My fabric network is first-network (BYFN) run inside docker containers and I would like to invoke chaincode using a node.js fabric-client application on a separate node (Raspberry Pi).
In connection-org1.json file, I have replaced the localhost domain names (in the peer urls) with my own domain name (mydomain.com) where the fabric network is running.
I execute invoke.js on Raspberry Pi with the following modified gateway settings:
await gateway.connect(ccpPath, { wallet, identity: 'user1', discovery: { enabled: true, asLocalhost: false } });
This gives me an error message:
2019-07-04T07:15:30.124Z - error: [Remote.js]: Error: Failed to connect before the deadline URL:grpcs://peer0.org1.example.com:7051
2019-07-04T07:15:30.132Z - warn: [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G0:0 - endorsement failed - Error: Failed to connect before the deadline URL:grpcs://peer0.org1.example.com:7051
2019-07-04T07:15:30.134Z - error: [Remote.js]: Error: Failed to connect before the deadline URL:grpcs://peer0.org2.example.com:9051
2019-07-04T07:15:30.135Z - warn: [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G1:1 - endorsement failed - Error: Failed to connect before the deadline URL:grpcs://peer0.org2.example.com:9051
Failed to submit transaction: Error: Endorsement has failed
I see that the domain names of the endorserers are the ones defined in the docker composer files, not the domain (mydomain.com) where my fabric network is running.
How should I configure the fabric network or the node.js fabric-client application so that I can invoke chaincode from my Raspberry Pi node?
I made a workaround where I extended the /etc/hosts file on my Raspberry Pi. I made the endorsing peer domain names peer0.org1.example.com and peer0.org2.example.com to point to the IP address of my host where I run the fabric network (docker).
This fixed the issue and now I'm able to invoke chaincode from the Raspberry Pi host.

Resources