我在查询或从Postman调用我的ubuntu服务器时遇到错误,该服务器显示sendProposal - timed out after:45000
,sendPeersProposal - Promise is rejected: Error: REQUEST_TIMEOUT
。我在调整,但无法弄清问题是什么。我正在使用balance-transfer example。运行容器如下:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f07e92dcdf7e my_node/node-app "npm start" 33 minutes ago Up 33 minutes 0.0.0.0:9999->4000/tcp my_node
f8b84ebc7510 hyperledger/fabric-peer "peer node start" 33 minutes ago Up 33 minutes 0.0.0.0:7056->7051/tcp, 0.0.0.0:7058->7053/tcp peer1.org1.example.com
301407e3285b hyperledger/fabric-peer "peer node start" 33 minutes ago Up 33 minutes 0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp peer0.org2.example.com
09ef3c426af2 hyperledger/fabric-peer "peer node start" 33 minutes ago Up 33 minutes 0.0.0.0:8056->7051/tcp, 0.0.0.0:8058->7053/tcp peer1.org2.example.com
d46778455d1a hyperledger/fabric-peer "peer node start" 33 minutes ago Up 33 minutes 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.org1.example.com
1e14126d1920 hyperledger/fabric-ca "sh -c 'fabric-ca-..." 33 minutes ago Up 33 minutes 0.0.0.0:7054->7054/tcp ca_peerOrg1
5bd780de76a9 hyperledger/fabric-ca "sh -c 'fabric-ca-..." 33 minutes ago Up 33 minutes 0.0.0.0:8054->7054/tcp ca_peerOrg2
beafd29107fa hyperledger/fabric-orderer "orderer" 33 minutes ago Up 33 minutes 0.0.0.0:7050->7050/tcp orderer.example.com
Full error log:
[2017-09-29 03:11:22.270] [DEBUG] Helper - [crypto_ecdsa_aes]: ecdsa signature: Signature {
r: <BN: 8afc8e33226a0f3a364ceb4c4826d3c442f26d92dda33fd7ff12027e214e354f>,
s: <BN: 1d7ff1d66ae71f27571b5d90e95f18fbcc1c52ee8954ae03c330f22c5206333b>,
recoveryParam: 0 }
error: [Peer.js]: sendProposal - timed out after:45000
error: [Peer.js]: sendProposal - timed out after:45000
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: REQUEST_TIMEOUT
at Timeout._onTimeout (/usr/src/app/node_modules/fabric-client/lib/Peer.js:107:19)
at ontimeout (timers.js:386:11)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: REQUEST_TIMEOUT
at Timeout._onTimeout (/usr/src/app/node_modules/fabric-client/lib/Peer.js:107:19)
at ontimeout (timers.js:386:11)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)
&#13;
第一个容器是在端口4000上公开的node.js API,然后是dockerized并与端口9999桥接。
我读到有一个bug,但它在Hyperledger v1.0.1上得到了解决。我怎么知道我使用的是什么版本,v1.0.0或v1.0.1? 附:我的Docker版本17.09.0-ce; docker-compose版本1.11.2。节点:硼。 network-config.json ca ip address(org1,org2):我的Ubuntu服务器ip 其他ips如Orderer和peer(请求,事件):localhost
任何建议都表示赞赏。谢谢!
更新
根据Gari的建议,我通过将localhost替换为servicenames来对network-config.json文件进行更改。它看起来像这样:
"network-config": {
"orderer": {
"url": "grpcs://orderer.example.com:7050",
"server-hostname": "orderer.example.com",
"tls_cacerts": "../artifacts/channel/crypto-config/ordererOrganizations/example.com/orderers$
},
"org1": {
"name": "peerOrg1",
"mspid": "Org1MSP",
"ca": "https://ca.org1.example.com:7054",
"peers": {
"peer1": {
"requests": "grpcs://peer0.org1.example.com:7051",
"events": "grpcs://peer0.org1.example.com:7053",
"server-hostname": "peer0.org1.example.com",
"tls_cacerts": "../artifacts/channel/crypto-config/peerOrganizations/org1.ex$
},
"peer2": {
"requests": "grpcs://peer1.org1.example.com:7056",
"events": "grpcs://peer1.org1.example.com:7058",
"server-hostname": "peer1.org1.example.com",
"tls_cacerts": "../artifacts/channel/crypto-config/peerOrganizations/org1.ex$
}
},
"admin": {
"key": "../artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users/$
"cert": "../artifacts/channel/crypto-config/peerOrganizations/org1.example.com/users$
}
},
"org2": {
"name": "peerOrg2",
"mspid": "Org2MSP",
"ca": "https://ca.org1.example.com:8054",
"peers": {
"peer1": {
"requests": "grpcs://peer0.org2.example.com:8051",
"events": "grpcs://peer0.org2.example.com:8053",
"server-hostname": "peer0.org2.example.com",
"tls_cacerts": "../artifacts/channel/crypto-config/peerOrganizations/org2.ex$
},
"peer2": {
"requests": "grpcs://peer1.org2.example.com:8056",
"events": "grpcs://peer1.org2.example.com:8058",
"server-hostname": "peer1.org2.example.com",
"tls_cacerts": "../artifacts/channel/crypto-config/peerOrganizations/org2.ex$
}
},
"admin": {
"key": "../artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users/$
"cert": "../artifacts/channel/crypto-config/peerOrganizations/org2.example.com/users$
}
}
}
}
&#13;
现在我可以进行前两次API调用,这是成功的:
第三次通话时出错加入频道请求 - sendPeersProposal - Promise is rejected: Error: Connect Failed
以前日志的完整错误消息:
[2017-09-30 06:30:04.753] [INFO] Join-Channel - received member object for admin of the organization "org1":
[2017-09-30 06:30:04.763] [DEBUG] Helper - [crypto_ecdsa_aes]: ecdsa signature: Signature {
r: <BN: 14e9fb6acf44b2d9d96d5888935085bb45a2363fc3171992e73cba41c612ec93>,
s: <BN: 1c800803823a185d0ed5a55f3a786bda1fc51827a0a296fbe432180d1e5165df>,
recoveryParam: 1 }
info: [EventHub.js]: _connect - options {"grpc.ssl_target_name_override":"peer0.org1.example.com","grpc.default_authority":"peer0.org1.example.com"}
[2017-09-30 06:30:04.807] [DEBUG] Helper - [crypto_ecdsa_aes]: ecdsa signature: Signature {
r: <BN: e1cdeef11d37de28810bed04d525abf4ed4959899f64e7129483110b07d9ef50>,
s: <BN: 65720ba0dfcdb959cce0a3d69b016097c7895aab1891172ded659aece90d467e>,
recoveryParam: 1 }
info: [EventHub.js]: _connect - options {"grpc.ssl_target_name_override":"peer1.org1.example.com","grpc.default_authority":"peer1.org1.example.com"}
[2017-09-30 06:30:04.814] [DEBUG] Helper - [crypto_ecdsa_aes]: ecdsa signature: Signature {
r: <BN: e1cdeef11d37de28810bed04d525abf4ed4959899f64e7129483110b07d9ef50>,
s: <BN: 65720ba0dfcdb959cce0a3d69b016097c7895aab1891172ded659aece90d467e>,
recoveryParam: 1 }
[2017-09-30 06:30:04.823] [DEBUG] Helper - [crypto_ecdsa_aes]: ecdsa signature: Signature {
r: <BN: ac5da50d7afa8c20be3c0833f7d034761eba2f5f3051abb90c095106be273e1d>,
s: <BN: 6815f1b1ce217faf6827521351e401f3f0accce9748ddc999de7649657024f21>,
recoveryParam: 1 }
[2017-09-30 06:30:04.835] [DEBUG] Helper - [crypto_ecdsa_aes]: ecdsa signature: Signature {
r: <BN: ab6a1ea9d36c8cabc53cad8cfdf545dc0f7e7751bf43979552bb980f7fcb4b7e>,
s: <BN: 1839adef53808d6e3ffba1f40495827cc6b4fa047d2c03dfe9ab76933581d35b>,
recoveryParam: 1 }
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: Connect Failed
at /usr/src/app/node_modules/grpc/src/node/src/client.js:554:15
(node:16) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'stack' of undefined
&#13;
在日志中,在错误消息之前,我可以看到尝试连接:{"grpc.ssl_target_name_override":"peer0.org1.example.com","grpc.default_authority":"peer0.org1.example.com"}
。也许 grpc 这里应该是 grpcs ,因为网络使用TLS。如果是的话,我的配置在哪里错了..任何提示,建议?
谢谢!
解决!
我在olegabu的有用评论后解决了这个问题。我使用REST API进行Hyperledger结构..
我仍然遇到同样的错误 - sendPeersProposal - Promise is rejected: Error: Connect Failed
- 当我运行以下请求时:加入通道上的对等项,安装Chaincode,实例化Chaincode 。尽管存在错误,但是同行仍然可以加入频道和频道,因为同伴可以使用。最后,我可以调用和查询分类帐。
P.S。我对olegabu答案的支持无法公开展示,因为我在stackoverflow上的声誉不足以做到这一点。但我非常感谢他的帮助,谢谢你!
答案 0 :(得分:1)
Gio,问题出在连接的某个地方,但我无法马上告诉你:在stackoverflow中你提到
node.js API在端口4000上公开,然后停靠并桥接到端口9999。
你可以分享你的回购所以我可以看看吗?
我要做的第一件事是连接到您的对等终结器,看看是否可以从其访问其他节点,并且证书文件可用。您正在使用TLS(来自协议中的grpcs,我是否应该假设TLS__ENABLE也适用于同行?)因此您的终端需要能够查看其对应的根证书文件(&#34; tls_cacerts&# 34;在netowork-config.js。
您可能需要查看https://github.com/olegabu/fabric-starter此repo具有部署到一个或多个服务器的脚本,具有带调试Web应用程序的REST API服务器。它使用的链码是您正在尝试的余额转移。也许这个回购会做你正在尝试做的事情,并且已经解决了这些问题。