Problem with multiple nodes and different profiles
alphacybercom opened this issue · comments
By referring to the context reported in a previous issue, I've created a blockchain network composed of two different nodes A
(primary) and B
(secondary), on two different hosts.
I also have two nodejs client applications (on A
and B
) which connect, respectively, to A
and B
through the vars/profiles/mychannel_connection_for_nodesdk.json connection profile files on the respective hosts.
I've implemented a custom chaincode, shared among the two nodes. Nevertheless, I'm not able to interact on the B
node.
The following error is returned by the node client on B
.
2022-02-02T17:59:05.485Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer1.org2.mydomain.com, url:grpcs://b-hostname:5001, connected:false, connectAttempted:true
2022-02-02T17:59:05.487Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer1.org2.mydomain.com url:grpcs://b-hostname:5001 timeout:3000
2022-02-02T17:59:05.488Z - info: [NetworkConfig]: buildPeer - Unable to connect to the endorser peer1.org2.mydomain.com due to Error: Failed to connect before the deadline on Endorser- name: peer1.org2.mydomain.com, url:grpcs://b-hostname:5001, connected:false, connectAttempted:true
2022-02-02T17:59:08.492Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer2.org2.mydomain.com, url:grpcs://b-hostname:5002, connected:false, connectAttempted:true
2022-02-02T17:59:08.492Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer2.org2.mydomain.com url:grpcs://b-hostname:5002 timeout:3000
2022-02-02T17:59:08.492Z - info: [NetworkConfig]: buildPeer - Unable to connect to the endorser peer2.org2.mydomain.com due to Error: Failed to connect before the deadline on Endorser- name: peer2.org2.mydomain.com, url:grpcs://b-hostname:5002, connected:false, connectAttempted:true
2022-02-02T17:59:08.537Z - error: [Endorser]: sendProposal[peer1.org2.mydomain.com] - rejecting with: Error: Broadcast Client peer1.org2.mydomain.com grpcs://b-hostname:5001 is not connected
2022-02-02T17:59:08.537Z - error: [Endorser]: sendProposal[peer2.org2.mydomain.com] - rejecting with: Error: Broadcast Client peer2.org2.mydomain.com grpcs://b-hostname:5002 is not connected
2022-02-02T17:59:08.539Z - error: [Transaction]: Error: No valid responses from any peers. Errors:
peer=peer1.org2.mydomain.com, status=grpc, message=Broadcast Client peer1.org2.mydomain.com grpcs://b-hostname:5001 is not connected
peer=peer2.org2.mydomain.com, status=grpc, message=Broadcast Client peer2.org2.mydomain.com grpcs://b-hostname:5002 is not connected
{ Error: No valid responses from any peers. Errors:
peer=peer1.org2.mydomain.com, status=grpc, message=Broadcast Client peer1.org2.mydomain.com grpcs://b-hostname:5001 is not connected
peer=peer2.org2.mydomain.com, status=grpc, message=Broadcast Client peer2.org2.mydomain.com grpcs://b-hostname:5002 is not connected
at newEndorsementError (/root/customapp/node_modules/fabric-network/lib/transaction.js:49:12)
at getResponsePayload (/root/customapp/node_modules/fabric-network/lib/transaction.js:17:23)
at Transaction.submit (/root/customapp/node_modules/fabric-network/lib/transaction.js:227:28)
at process._tickCallback (internal/process/next_tick.js:68:7)
responses: [],
errors:
[ { Error: Broadcast Client peer1.org2.mydomain.com grpcs://b-hostname:5001 is not connected
at Promise (/root/customapp/node_modules/fabric-common/lib/Endorser.js:133:11)
at new Promise (<anonymous>)
at Endorser.sendProposal (/root/customapp/node_modules/fabric-common/lib/Endorser.js:126:10)
at Endorsement.send (/root/customapp/node_modules/fabric-common/lib/Proposal.js:427:25)
at Transaction.submit (/root/customapp/node_modules/fabric-network/lib/transaction.js:225:52)
at ContractImpl.submitTransaction (/root/customapp/node_modules/fabric-network/lib/contract.js:187:45)
at execute (/root/customapp/app.js:29:68)
at connectandrun (/root/customapp/app.js:85:2)
at process._tickCallback (internal/process/next_tick.js:68:7) connection: [Object], peer: 'peer1.org2.mydomain.com' },
{ Error: Broadcast Client peer2.org2.mydomain.com grpcs://b-hostname:5002 is not connected
at Promise (/root/customapp/node_modules/fabric-common/lib/Endorser.js:133:11)
at new Promise (<anonymous>)
at Endorser.sendProposal (/root/customapp/node_modules/fabric-common/lib/Endorser.js:126:10)
at Endorsement.send (/root/customapp/node_modules/fabric-common/lib/Proposal.js:427:25)
at Transaction.submit (/root/customapp/node_modules/fabric-network/lib/transaction.js:225:52)
at ContractImpl.submitTransaction (/root/customapp/node_modules/fabric-network/lib/contract.js:187:45)
at execute (/root/customapp/app.js:29:68)
at connectandrun (/root/customapp/app.js:85:2)
at process._tickCallback (internal/process/next_tick.js:68:7) connection: [Object], peer: 'peer2.org2.mydomain.com' } ] }
I believe the problem is related to some kind of authorization provided to B
to interact on the chaincode "managed by" A
.
I also make you notice that the custom chaincode is transferred through scp from A
to B
: I'm not sure this is the right process.
Just for completeness, here is the sketch of the commands used to connect the two nodes.
# A:
scp ${B_USER}@${B_HOST}:${MINIFAB_FOLDER}/vars/JoinRequest_org2-mydomain-com.json vars/NewOrgJoinRequest.json
sudo ./minifab orgjoin
sudo ./minifab channelquery
scp vars/profiles/endpoints.yaml ${B_USER}@${B_HOST}:${MINIFAB_FOLDER}/vars/
scp -r vars/chaincode/${CHAINCODENAME} ${B_USER}@${B_HOST}:${MINIFAB_FOLDER}/vars/chaincode/
# B:
sudo ./minifab nodeimport,join
sudo ./minifab discover
sudo ./minifab install,approve -n ${CHAINCODENAME} -p '' -l node -v 1.0.0
# A:
sudo ./minifab approve,discover,commit
# B:
sudo ./minifab anchorupdate
sudo ./minifab profilegen
# B nodejs client settings:
# - connection profile location: ${MINIFAB_FOLDER}/vars/profiles/mychannel_connection_for_nodesdk.json
# - wallet folder location: ${MINIFAB_FOLDER}/vars/profiles/vscode/wallets/org2.mydomain.com
How can I solve the issue?
Also, by running a simple query (sudo ./minifab invoke -n ${CHAINCODENAME} -p '"query","a"'
) on B
, here is the returned error.
Using spec file: ${MINIFAB_FOLDER}/spec.yaml
Minifab Execution Context:
FABRIC_RELEASE=2.3.0
CHANNEL_NAME=mychannel
PEER_DATABASE_TYPE=couchdb
CHAINCODE_LANGUAGE=node
CHAINCODE_NAME=${CHAINCODENAME}
CHAINCODE_VERSION=1.0.0
CHAINCODE_INIT_REQUIRED=true
CHAINCODE_PARAMETERS="query","a"
CHAINCODE_PRIVATE=false
CHAINCODE_POLICY=
TRANSIENT_DATA=
BLOCK_NUMBER=newest
EXPOSE_ENDPOINTS=5000
CURRENT_ORG=org2.mydomain.com
HOST_ADDRESSES=${B-HOST}
WORKING_DIRECTORY: ${MINIFAB_FOLDER}
.......
# Preparing for the following operations: *********************
verify options, cc invoke
........
# Running operation: ******************************************
verify options
.
# Running operation: ******************************************
cc invoke
.............
# Run the chaincode invoke script on cli container ************
non-zero return code
Error: No such container: ${NETNAME}
# STATS *******************************************************
minifab: ok=33 failed=1
real 0m15.716s
user 0m13.556s
sys 0m2.271s
The error was solved by running rm -f /var/lib/docker
, hence restarting the host.