Hyperledger Fabric Error - Attempted to contact 2 Peers. Last error was Error: Failed to connect before the deadline

Hyperledger Fabric Error - Attempted to contact 2 Peers. Last error was Error: Failed to connect before the deadline

  1. 我使用 byfn.sh 培养了 4 个同伴。
  2. 一切正常,我可以在 docker 个容器中看到 ordererpeersCA nodes 等 运行
  3. 然后我使用自定义服务层应用程序,该应用程序使用 Fabric Node SDK 连接到该网络。
  4. 我使用 byfn.sh 生成的 TLS CA 证书 (/usr/local/src/test_env/hlf_scripts/first-network/crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem)
  5. 建立连接没有问题
  6. 以下是 docker 次调用的日志消息 Gateway.getNetwork(“mychannel”):
2020-01-14 22:12:20.981 UTC [comm.grpc.server] 1 -> INFO 083 unary call completed grpc.service=discovery.Discovery grpc.method=Discover grpc.peer_address=192.168.80.1:38858 grpc.code=OK grpc.call_duration=515.21µs

2020-01-14 22:12:21.012 UTC [comm.grpc.server] 1 -> INFO 084 unary call completed grpc.service=discovery.Discovery grpc.method=Discover grpc.peer_address=192.168.80.1:38858 grpc.code=OK grpc.call_duration=552.801µs
  1. 然后我启动另一个客户端应用程序,它使用几乎相同的代码来操纵网络。这里的第一步是确保用户(在本例中为管理员)的身份存在并且可以导入到钱包中。同一段代码用于生成此标识,并使用相同的连接配置文件 (connection_org1.json)。可以创建身份并将其导入文件系统钱包。
  2. 我可以使用 Gateway.connect(…) 方法和连接配置文件 connection_org1.json 连接到网络。然而,在我调用 Gateway.getNetwork(“mychannel”) 的那一刻,我的问题就开始了。这是 Fabric SDK 返回的错误:
    [nodemon] starting `node ./dist/server.js`

    Express server listening on port 3050

    Wallet path: /usr/local/src/fabric-network-code/wallet

    E0114 17:16:47.872273165    1998 ssl_transport_security.cc:1238] Handshake failed with fatal error SSL_ERROR_SSL: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed.

    E0114 17:16:48.873788447    1998 ssl_transport_security.cc:1238] Handshake failed with fatal error SSL_ERROR_SSL: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed.

    E0114 17:16:50.368082218    1998 ssl_transport_security.cc:1238] Handshake failed with fatal error SSL_ERROR_SSL: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed.

    2020-01-14T22:16:50.869Z - error: [Remote.js]: Error: Failed to connect before the deadline URL:grpcs://localhost:7051

    2020-01-14T22:16:50.870Z - error: [Channel.js]: Error: Failed to connect before the deadline URL:grpcs://localhost:7051

    E0114 17:16:50.877630619    1998 ssl_transport_security.cc:1238] Handshake failed with fatal error SSL_ERROR_SSL: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed.

    E0114 17:16:51.876732084    1998 ssl_transport_security.cc:1238] Handshake failed with fatal error SSL_ERROR_SSL: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed.

    E0114 17:16:53.263732590    1998 ssl_transport_security.cc:1238] Handshake failed with fatal error SSL_ERROR_SSL: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed.

    E0114 17:16:53.303070959    1998 ssl_transport_security.cc:1238] Handshake failed with fatal error SSL_ERROR_SSL: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed.

    2020-01-14T22:16:53.875Z - error: [Remote.js]: Error: Failed to connect before the deadline URL:grpcs://localhost:8051

    2020-01-14T22:16:53.875Z - error: [Channel.js]: Error: Failed to connect before the deadline URL:grpcs://localhost:8051

    2020-01-14T22:16:53.875Z - error: [Network]: _initializeInternalChannel: Unable to initialize channel. Attempted to contact 2 Peers. Last error was Error: Failed to connect before the deadline URL:grpcs://localhost:8051

    Unable to initialize channel. Attempted to contact 2 Peers. Last error was Error: Failed to connect before the deadline URL:grpcs://localhost:8051

    [nodemon] app crashed - waiting for file changes before starting...
  1. 这里是 peer0 的 docker 容器日志中的日志。org1.example.com
    2020-01-14 22:16:47.872 UTC [core.comm] ServerHandshake -> ERRO 085 TLS handshake failed with error EOF server=PeerServer remoteaddress=192.168.80.1:38886

    2020-01-14 22:16:48.874 UTC [core.comm] ServerHandshake -> ERRO 086 TLS handshake failed with error EOF server=PeerServer remoteaddress=192.168.80.1:38890

    2020-01-14 22:16:50.368 UTC [core.comm] ServerHandshake -> ERRO 087 TLS handshake failed with error EOF server=PeerServer remoteaddress=192.168.80.1:38894

    2020-01-14 22:16:53.303 UTC [core.comm] ServerHandshake -> ERRO 088 TLS handshake failed with error EOF server=PeerServer remoteaddress=192.168.80.1:38910

我尝试了使用不同证书的各种排列和组合,但没有取得任何进展。在线论坛表明这是订购者和同行之间的沟通问题。但是,orderer 中没有错误消息。

我在 chat.hyperledger.org 中问过这个问题,但还没有回复。

我太傻了。我的节点项目文件夹中有一个 crypto-config 目录(我不知道我什么时候可能已经复制了它......)并且它丢弃了 tlscacert 变量。

我已经删除了有问题的目录,现在它正在读取 .../first-network/crypto-config/.../<tlsca file>.pem

下的正确目录

有时(而且经常 :-) )答案就在那里,但是太笨了看不到!!!