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

我的未来我决定 提交于 2020-03-04 17:41:52

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/56885082/endorsement-fails-when-node-js-fabric-client-application-is-run-on-a-separate-no

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!