“Error: no suitable peers available to initiize from” when querying the blockchain

别来无恙 提交于 2020-01-31 18:30:20

问题


I've been working with the IBM Blockchain v2 beta for the past few months. About 2 weeks ago (with the platform's update to 1.4.1), I've been getting this error:

"Error processing transaction. Error: no suitable peers available to initialize from"

I have attempted to clear and start a new network, using the same configuration as before. But I am still getting this error.

Connection profile:

{
    "name": "mychannel",
    "description": "Network on IBP v2",
    "version": "1.0.0",
    "client": {
        "organization": "org1msp"
    },
    "organizations": {
        "org1msp": {
            "mspid": "org1msp",
            "peers": [
                "173.193.78.236:32758"
            ],
            "certificateAuthorities": [
                "173.193.78.236:32153"
            ]
        }
    },
    "orderers": {
        "173.193.78.236:30360": {
            "url": "grpcs://173.193.78.236:30360",
            "tlsCACerts": {
                "pem": "-----BEGIN CERTIFICATE-----\nMIICKDCCAc6gAwIBAgIULF/WNZP4tLQb1j1WDEPiHUuKo9owCgYIKoZIzj0EAwIw\nZTELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQK\nEwtIeXBlcmxlZGdlcjEPMA0GA1UECxMGRmFicmljMRYwFAYDVQQDEw1PcmRlcmVy\nQ0EtdGxzMB4XDTE5MDYwNTA1NDUwMFoXDTM0MDYwMTA1NDUwMFowZTELMAkGA1UE\nBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQKEwtIeXBlcmxl\nZGdlcjEPMA0GA1UECxMGRmFicmljMRYwFAYDVQQDEw1PcmRlcmVyQ0EtdGxzMFkw\nEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEEV4XYJmpL+70hlChQRmoEDic2843FLje\ntP6Jc5gaQFlj+hObYrAPAmXnZT9TSFqEz3v1cQIXmxqsi63SPOY4LaNcMFowDgYD\nVR0PAQH/BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQEwHQYDVR0OBBYEFKPw9Hvm\nCMSEGJ7k81u1XkgcsL2jMBUGA1UdEQQOMAyHBK3BT+yHBAovepMwCgYIKoZIzj0E\nAwIDSAAwRQIhAJj1YK2QptBVbaqX6FcVUyKzC/RQ+g+P/xLXr1MJCoeIAiB+NFii\nGIkmI2zmPvspkui+feBwMdBAl8H+Qeb1VsLZMQ==\n-----END CERTIFICATE-----\n"
            }
        }
    },
    "peers": {
        "173.193.79.236:32758": {
            "url": "grpcs://173.193.79.236:32758",
            "tlsCACerts": {
                "pem": "-----BEGIN CERTIFICATE-----\nMIICITCCAcigAwIBAgIURAV0BZcyHwWpDXAWcOdU4jRfQW4wCgYIKoZIzj0EAwIw\nYjELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQK\nEwtIeXBlcmxlZGdlcjEPMA0GA1UECxMGRmFicmljMRMwEQYDVQQDEwpPcmcxQ0Et\ndGxzMB4XDTE5MDYwNTA1MzcwMFoXDTM0MDYwMTA1MzcwMFowYjELMAkGA1UEBhMC\nVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMRQwEgYDVQQKEwtIeXBlcmxlZGdl\ncjEPMA0GA1UECxMGRmFicmljMRMwEQYDVQQDEwpPcmcxQ0EtdGxzMFkwEwYHKoZI\nzj0CAQYIKoZIzj0DAQcDQgAEnIYUnQDBa0fOeQ+3Z9QN8Af21z6l8l8MxXPw3OPP\n3Ssajl6bigEmPpfWlq0aj3L3p9OFlS5GJgEegXb5v2qtn6NcMFowDgYDVR0PAQH/\nBAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQEwHQYDVR0OBBYEFMu/9gjnJroF8WI5\npCzFkBjQ+XRdMBUGA1UdEQQOMAyHBK3BT+yHBAovepMwCgYIKoZIzj0EAwIDRwAw\nRAIgeLh+7v0DduBFnaB4L31UD+X4l81QjB+eY+hLpArwagECIA2TbthMiV2sQnDF\nQLIZo/iz1fXBVCl72QUxlStHRXY/\n-----END CERTIFICATE-----\n"
            },
            "grpcOptions": {
                "ssl-target-name-override": "173.193.78.236"
            }
        }
    },
    "certificateAuthorities": {
        "173.193.78.236:32153": {
            "url": "https://173.193.78.236:32153",
            "caName": "ca",
            "tlsCACerts": {
                "pem": "-----BEGIN CERTIFICATE-----\r\nMIICeTCCAeKgAwIBAgIJEk5d1AerUcGfMA0GCSqGSIb3DQEBBQUAMHQxFzAVBgNV\r\nBAMTDjE3My4xOTMuNzkuMjM2MQswCQYDVQQGEwJVUzEXMBUGA1UECBMOTm9ydGgg\r\nQ2Fyb2xpbmExEDAOBgNVBAcTB1JhbGVpZ2gxDDAKBgNVBAoTA0lCTTETMBEGA1UE\r\nCxMKQmxvY2tjaGFpbjAeFw0xOTA2MDUwNTQxNDBaFw0yMDA2MDQwNTQxNDBaMHQx\r\nFzAVBgNVBAMTDjE3My4xOTMuNzkuMjM2MQswCQYDVQQGEwJVUzEXMBUGA1UECBMO\r\nTm9ydGggQ2Fyb2xpbmExEDAOBgNVBAcTB1JhbGVpZ2gxDDAKBgNVBAoTA0lCTTET\r\nMBEGA1UECxMKQmxvY2tjaGFpbjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA\r\nk4OR+iK7u6c34+KzDNyZXCTPhr3tjl/qTmayU5IVXKc/fHOoWkyccsl2+oUa29cH\r\nEd4z12Ugv36d7Jh0RmrdAHZZK87iXEuFHL2DZe9hXxlQ4FenaHR6NACK+MxDtxy1\r\nNRiL+2Uxp86jBJZGUiydscKDl0xeRQpFygmHyB64pXcCAwEAAaMTMBEwDwYDVR0R\r\nBAgwBocErcFP7DANBgkqhkiG9w0BAQUFAAOBgQCKUDIAMUMoIwbBxmsxdqSjGOkA\r\ni9fywxFc9L1JzrO/KzFDnmzP1SWwa6dJBpyicY5K37bdM4nFlQUIaXjiPHF250Qq\r\ntyb/DzNw+81ouEsegKZWlK0DPmSEY28QD2eMcVwW3Oo0QviY4JmS9RzqKvOp4IA5\r\nl1vKEo4aiETiXS9sig==\r\n-----END CERTIFICATE-----\r\n"
            }
        }
    }
}

With today's GA release, I started a new network and configured it as normal. However, I'm still experiencing the error.

Any possible reasons for this error?


回答1:


If you're using node sdk. In order connect to the Gateway with a connection profile (gateway.connect) in DiscoveryOptions. You may add gateway option like this.:

discovery: {
  "enabled": true,
  "asLocalhost": false }



回答2:


I've the same issue, and the problem was the connection profile. You need to add channel configuration before "organizations".

Here is an example.

"channels": {
    "mychannel": {
        "orderers":  [
            "orderer.example.com"
        ],
        "peers":{
            "peer0.org1.example.com": []
        }
    }
},



回答3:


This error looks like it is a result of not configuring anchor peers. You need to configure anchor peers in order to use service discovery to get the full list of peers needed to endorse the transaction. The connection profile just has your own organizations peers.

On IBP, you can configure anchor peers on the channels panel.




回答4:


The same issue occurred but was finally resolved by correcting the profile file path.

The channels section is not required if discovery is enabled.




回答5:


I wanted to share how I solved my problem. The problem was that when I require connection profile file, it was getting cached and new added channels were not present and it was giving me the error. Anyone who has a similar error, please check ur connection profile while gateway is connecting to the network.

const networkPath = hfc.getConfigSetting('network-file-path');
delete require.cache[networkPath];
const connectionProfile = require(networkPath);



回答6:


i had the same problem and it was all my fault. i created a credential with organization MSP that doesn't exist.

    const identityLabel = 'User1@org1.bionic.com';
    const identity = X509WalletMixin.createIdentity('Org1', cert, key);

   await wallet.import(identityLabel, identity);

here there was no Org1 MSP address but Org1MSP. after fixing that it worked so check what your credential MSP is. hopefully i'll save someones precious time because i've spent almost 2 days with this problem and no solution on the internet for HL

    const identityLabel = 'User1@org1.bionic.com';
    const identity = X509WalletMixin.createIdentity('Org1MSP', cert, key);
    await wallet.import(identityLabel, identity);


来源:https://stackoverflow.com/questions/56455251/error-no-suitable-peers-available-to-initiize-from-when-querying-the-blockcha

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