Re: Peer cannot discover orderer when node.js application is used to invoke chaincode #fabric-sdk-node #fabric-orderer #hyperledger-fabric #fabric-peer


h.dungca@...
 

Good day,

Thank you for your reply! And apologies for my late reply.

For the TLS certificates, I used the registerEnroll.sh script that is included in the test-network files (in /test-network/organizations/fabric-ca/) to generate the certificates I needed. However, I modified the script so that it uses the IP addresses of the orderer and peers. I changed instances of localhost in the script to the appropriate internal IP addresses. I've attached the modified scripts to this reply.

With this, I do believe that I have the correct TLS certificates. I may be wrong though and I might be missing something, so your help would be greatly appreciated!

Another thing I noticed is that when I use the node.js application to query the chaincode, I still get the results of the query despite getting the error I mentioned in my first message. So when I query, the response is something like this:

error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Committer- name: 172.31.42.206:7050, url:grpcs://172.31.42.206:7050, connected:false, connectAttempted:true

error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server 172.31.42.206:7050 url:grpcs://172.31.42.206:7050 timeout:3000

error: [DiscoveryService]: _buildOrderer[channel1] - Unable to connect to the discovered orderer 172.31.42.206:7050 due to Error: Failed to connect before the deadline on Committer- name: 172.31.42.206:7050, url:grpcs://172.31.42.206:7050, connected:false, connectAttempted:true

Results: [{"Key":"CAR0","Record":{"make":"Toyota","model":"Prius","colour":"blue","owner":"Tomoko"}},{"Key":"CAR1","Record":{"make":"Ford","model":"Mustang","colour":"red","owner":"Brad"}},{"Key":"CAR2","Record":{"make":"Hyundai","model":"Tucson","colour":"green","owner":"Jin Soo"}},{"Key":"CAR3","Record":{"make":"Volkswagen","model":"Passat","colour":"yellow","owner":"Max"}},{"Key":"CAR4","Record":{"make":"Tesla","model":"S","colour":"black","owner":"Adriana"}},{"Key":"CAR5","Record":{"make":"Peugeot","model":"205","colour":"purple","owner":"Michel"}},{"Key":"CAR6","Record":{"make":"Chery","model":"S22L","colour":"white","owner":"Aarav"}},{"Key":"CAR7","Record":{"make":"Fiat","model":"Punto","colour":"violet","owner":"Pari"}},{"Key":"CAR8","Record":{"make":"Tata","model":"Nano","colour":"indigo","owner":"Valeria"}},{"Key":"CAR9","Record":{"make":"Holden","model":"Barina","colour":"brown","owner":"Shotaro"}}]
success

However, when I try invoking the chaincode using the application, I get the error shown below and the invocation does not go through.

error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Committer- name: 172.31.42.206:7050, url:grpcs://172.31.42.206:7050, connected:false, connectAttempted:true

error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server 172.31.42.206:7050 url:grpcs://172.31.42.206:7050 timeout:3000

error: [DiscoveryService]: _buildOrderer[channel1] - Unable to connect to the discovered orderer 172.31.42.206:7050 due to Error: Failed to connect before the deadline on Committer- name: 172.31.42.206:7050, url:grpcs://172.31.42.206:7050, connected:false, connectAttempted:true

error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Committer- name: 172.31.42.206:7050, url:grpcs://172.31.42.206:7050, connected:false, connectAttempted:true

error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server 172.31.42.206:7050 url:grpcs://172.31.42.206:7050 timeout:3000

error: [DiscoveryService]: _buildOrderer[fabcar] - Unable to connect to the discovered orderer 172.31.42.206:7050 due to Error: Failed to connect before the deadline on Committer- name: 172.31.42.206:7050, url:grpcs://172.31.42.206:7050, connected:false, connectAttempted:true

Error: Error: No committers assigned to the channel

So in the case of the fabcar chaincode, I can query to get information on all the cars, but I cannot add a car by invoking the chaincode using the node.js application.

If it's not an issue with the TLS certificates, might there be something else that's causing the peer to not see the orderer when using the node.js application?

Thank you so much for your help!

Join fabric@lists.hyperledger.org to automatically receive all group messages.