Sdk 未能在截止日期前连接

Sdk 未能在截止日期前连接,sdk,hyperledger-fabric,blockchain,hyperledger,Sdk,Hyperledger Fabric,Blockchain,Hyperledger,我试图在我的ubuntu上本地运行hyperledger结构网络 现在,我通过邮递员iam在docker上运行API服务器,试图连接到docker上的API服务器,并且端口也已映射 我可以从本地计算机上运行的ca服务颁发证书,但当我试图查询任何内容时,会出现错误 连接配置文件 "name": "first-network-org1", "version": "1.0.0", "client": { "organization": "Org1",

我试图在我的ubuntu上本地运行hyperledger结构网络

现在,我通过邮递员iam在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.


019-08-31T03:22:19.109Z-错误:[Remote.js]:错误:在截止日期URL之前连接失败:grpcs://192.168.19.135:7051
2019-08-31T03:22:19.111Z-错误:[Channel.js]:错误:在截止日期URL之前连接失败:grpcs://192.168.19.135:7051
2019-08-31T03:22:22.120Z-错误:[Remote.js]:错误:在截止日期URL之前连接失败:grpcs://192.168.19.135:8051
2019-08-31T03:22:22.120Z-错误:[Channel.js]:错误:在截止日期URL之前连接失败:grpcs://192.168.19.135:8051
2019-08-31T03:22:22.121Z-错误:[网络]:_initializeInternalChannel:无法初始化通道。试图联系2个对等方。最后一个错误是错误:在截止日期URL之前连接失败:grpcs://192.168.19.135:8051
(节点:1)未处理的PromisejectionWarning:错误:无法初始化通道。试图联系2个对等方。最后一个错误是错误:在截止日期URL之前连接失败:grpcs://192.168.19.135:8051
在网络上初始化InternalChannel(/middleware/api server/node\u modules/fabric Network/lib/Network.js:112:12)
在
在进程中。_tick回调(内部/process/next_tick.js:189:7)
(节点:1)未处理的PromisejectionWarning:未处理的承诺拒绝。此错误源于在没有catch块的异步函数中抛出,或者拒绝未使用.catch()处理的承诺。(拒绝id:1)
(节点:1)[DEP0018]弃用警告:未处理的承诺拒绝已弃用。将来,未处理的承诺拒绝将使用非零退出代码终止Node.js进程。
“ssl目标名称覆盖”:{service_name}

检查下面更新的配置文件

"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
            }
        }
    }
}

是的,我有更早的服务名称在这里,但它总是试图ping的grpcs://localhost:7051 不是在实际对等机运行的地方,我在docker中向我的ubuntu机器发出请求{“message”:{“message”:“无法初始化通道。尝试与2个对等方联系。最后一个错误是错误:在截止日期URL之前连接失败:grpcs://192.168.19.135:8051,“堆栈”:错误:无法初始化通道。尝试与2个对等方联系。最后一个错误是错误:在截止日期URL之前连接失败:grpcs://192.168.19.135:8051\n在网络上。\u初始化内部通道(/middleware/api server/node\u modules/fabric Network/lib/Network.js:112:12)\n在进程上。\u(internal/process/next_tick.js:189:7)“}尝试在docker swarm中运行api server和hyperledger,并在连接配置文件中将所有IP替换为本地主机谢谢您的回答,但现在我可以从docker容器访问对等方。刚刚添加-将主机标志添加到docker run命令,这就是为什么您应该尽可能多地简要说明您的问题。如果您已经离开文件或docker run命令很容易发出。此外,在处理多个服务时,不要使用docker run,使用带链接的撰写文件或像swarm一样使用或隔离。
"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
            }
        }
    }
}