首页 > 解决方案 > 截止日期前无法连接

问题描述

我正在尝试在我的 ubuntu 上本地运行一个超级账本结构网络。

现在我通过邮递员在 docker 上运行 API 服务器,我试图连接到 docker 上的 API 服务器,并且端口也被映射

我可以从本地计算机上运行的 ca 服务颁发证书,但是当我尝试查询任何内容时,出现错误

连接配置文件

    "name": "first-network-org1",
    "version": "1.0.0",
    "client": {
        "organization": "Org1",
        "connection": {
            "timeout": {
                "peer": {
                    "endorser": "3000"
                }
            }
        }
    },
    "organizations": {
        "Org1": {
            "mspid": "Org1MSP",
            "peers": [
                "peer0.org1.example.com",
                "peer1.org1.example.com"
            ],
            "certificateAuthorities": [
                "ca.org1.example.com"
            ]
        }
    },
    "peers": {
        "peer0.org1.example.com": {
            "url": "grpcs://192.168.19.135:7051",
            "tlsCACerts": {
                "path": "crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem"
            },
            "grpcOptions": {
                "ssl-target-name-override": "192.168.19.135"
            }
        },
        "peer1.org1.example.com": {
            "url": "grpcs://192.168.19.135:8051",
            "tlsCACerts": {
                "path": "crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem"
            },
            "grpcOptions": {
                "ssl-target-name-override": "192.168.19.135"
            }
        }
    },
    "certificateAuthorities": {
        "ca.org1.example.com": {
            "url": "https://MYIP:7054",
            "caName": "ca-org1",
            "tlsCACerts": {
                "path": "crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem"
            },
            "httpOptions": {
                "verify": false
            }
        }
    }
}

这是错误

019-08-31T03:22:19.109Z - error: [Remote.js]: Error: Failed to connect before the deadline URL:grpcs://192.168.19.135:7051
2019-08-31T03:22:19.111Z - error: [Channel.js]: Error: Failed to connect before the deadline URL:grpcs://192.168.19.135:7051
2019-08-31T03:22:22.120Z - error: [Remote.js]: Error: Failed to connect before the deadline URL:grpcs://192.168.19.135:8051
2019-08-31T03:22:22.120Z - error: [Channel.js]: Error: Failed to connect before the deadline URL:grpcs://192.168.19.135:8051
2019-08-31T03:22:22.121Z - error: [Network]: _initializeInternalChannel: Unable to initialize channel. Attempted to contact 2 Peers. Last error was Error: Failed to connect before the deadline URL:grpcs://192.168.19.135:8051
(node:1) UnhandledPromiseRejectionWarning: Error: Unable to initialize channel. Attempted to contact 2 Peers. Last error was Error: Failed to connect before the deadline URL:grpcs://192.168.19.135:8051
    at Network._initializeInternalChannel (/middleware/api-server/node_modules/fabric-network/lib/network.js:112:12)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.


标签: sdkhyperledger-fabricblockchainhyperledger

解决方案


Error: Failed to connect before the deadline 

"ssl-target-name-override": "192.168.19.135" >>> Should not be IP address

“ssl 目标名称覆盖”:{服务名称}

检查以下更新的配置文件

"name": "first-network-org1",
    "version": "1.0.0",
    "client": {
        "organization": "Org1",
        "connection": {
            "timeout": {
                "peer": {
                    "endorser": "3000"
                }
            }
        }
    },
    "organizations": {
        "Org1": {
            "mspid": "Org1MSP",
            "peers": [
                "peer0.org1.example.com",
                "peer1.org1.example.com"
            ],
            "certificateAuthorities": [
                "ca.org1.example.com"
            ]
        }
    },
    "peers": {
        "peer0.org1.example.com": {
            "url": "grpcs://192.168.19.135:7051",
            "tlsCACerts": {
                "path": "crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem"
            },
            "grpcOptions": {
                "ssl-target-name-override": "peer0.org1.example.com"
            }
        },
        "peer1.org1.example.com": {
            "url": "grpcs://192.168.19.135:8051",
            "tlsCACerts": {
                "path": "crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem"
            },
            "grpcOptions": {
                "ssl-target-name-override": "peer1.org1.example.com"
            }
        }
    },
    "certificateAuthorities": {
        "ca.org1.example.com": {
            "url": "https://MYIP:7054",
            "caName": "ca-org1",
            "tlsCACerts": {
                "path": "crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem"
            },
            "httpOptions": {
                "verify": false
            }
        }
    }
}

推荐阅读