How to setup hyperledger fabric explorer | Hyperledger Fabric consortium on Azure Kubernetes Service (AKS)

selvam 1 Reputation point
2020-07-08T18:27:23.127+00:00

I set up hyperledger fabric network by reading this document https://learn.microsoft.com/en-us/azure/blockchain/templates/hyperledger-fabric-consortium-azure-kubernetes-service. Network side everything worked properly. Now I wanted to set up hyperledger fabric explorer for this network. In order to do that, I did the follwing steps,

  1. git clone https://github.com/hyperledger/blockchain-explorer.git
  2. git checkout tags/v1.0.0-rc2
  3. app/persistence/fabric/postgreSQL/db
  4. ./createdb.sh
  5. ./main.sh install
  6. Replaced the connection profile (app/platform/fabric/connection-profile/first-network.json) like the following,
     {
      "certificateAuthorities": {
        "ca.xxxxxxxxxxxxx.eastus.aksapp.io": {
          "caName": "ca.org1",
          "tlsCACerts": {
          "pem": "-----BEGIN CERTIFICATE-----dfsajk-----END CERTIFICATE-----\n"
          },
          "url": "grpcs://ca.xxxxxxxxxxxxx.eastus.aksapp.io:443"
        }
      },
      "client": {
        "tlsEnable": true,
        "adminUser": "admin.org1",
        "adminPassword": "",
        "enableAuthentication": false,
        "connection": {
          "timeout": {
            "orderer": "300",
            "peer": {
              "endorser": "300"
            }
          }
        },
        "organization": "org1"
      },
    "channels": {
        "hrschannel": {
            "orderers": ["orderer1.yyyyyyyyyyyyyyyyyyyyy.eastus.aksapp.io"],
            "peers": {
                "peer1.xxxxxxxxxxxxx.eastus.aksapp.io": {}
            }
        }
    },
      "name": "org1",
      "organizations": {
        "org1": {
          "certificateAuthorities": [
            "org1CA"
          ],
          "mspid": "org1",
          "peers": [
            "peer1.xxxxxxxxxxxxx.eastus.aksapp.io"
          ]
        }
      },
      "peers": {
        "peer1.xxxxxxxxxxxxx.eastus.aksapp.io": {
          "grpcOptions": {
            "hostnameOverride": "peer1.xxxxxxxxxxxxx.eastus.aksapp.io",
            "ssl-target-name-override": "peer1.xxxxxxxxxxxxx.eastus.aksapp.io"
          },
          "tlsCACerts": {
            "pem": "-----BEGIN CERTIFICATE-----jjdadjijfifawj-----END CERTIFICATE-----\n"
          },
          "url": "grpcs://peer1.xxxxxxxxxxxxx.eastus.aksapp.io:443"
        }
      },
      "version": "1.0.0",
      "wallet": "org1"
    }
    

But I got the following error here tail -f logs/console/console-2020-07-08.log

false 'ssl-certs' '/home/css/delete/blockchain-explorer/ssl-certs'
******* Initialization started for hyperledger fabric platform ******, { 'first-network':
   { name: 'first-network',
     profile: './connection-profile/first-network.json' } }
 client_configs.name  first-network  client_configs.profile  ./connection-profile/first-network.json
FabricUtils.createFabricClient
config.client.tlsEnable  true
FabricConfig, this.config.channels  hrschannel
initializeChannelFromDiscover  hrschannel
 FabricClient.discover_results  endpoint  { host: 'orderer1.1111111111111111111.eastus.aksapp.io',
  port: 443 }

initializeChannelFromDiscover.discoveryProtocol  grpcs  requesturl  grpcs://orderer1.1111111111111111111.eastus.aksapp.io:443

 FabricClient.discover_results  endpoint  { host: 'orderer2.1111111111111111111.eastus.aksapp.io',
  port: 443 }

initializeChannelFromDiscover.discoveryProtocol  grpcs  requesturl  grpcs://orderer2.1111111111111111111.eastus.aksapp.io:443

 FabricClient.discover_results  endpoint  { host: 'orderer3.1111111111111111111.eastus.aksapp.io',
  port: 443 }

initializeChannelFromDiscover.discoveryProtocol  grpcs  requesturl  grpcs://orderer3.1111111111111111111.eastus.aksapp.io:443

2020-07-08T16:15:30.879Z - error: [Remote.js]: Error: Failed to connect before the deadline URL:grpcs://localhost:443
FabricUtils.createDetachClient
initializeListener, client_name, client  first-network { name: 'first-network',
  profile: './connection-profile/first-network.json' }


Please open web browser to access ???http://localhost:8080/


pid is 13408



Sync process is started for the network : [first-network] and client : [first-network]
config.client.tlsEnable  true
FabricConfig, this.config.channels  hrschannel
(node:13836) DeprecationWarning: grpc.load: Use the @grpc/proto-loader module with grpc.loadPackageDefinition instead
An identity for the admin user: admin.org1 already exists in the wallet
initializeChannelFromDiscover  hrschannel
 FabricClient.discover_results  endpoint  { host: 'orderer1.1111111111111111111.eastus.aksapp.io',
  port: 443 }

initializeChannelFromDiscover.discoveryProtocol  grpcs  requesturl  grpcs://orderer1.1111111111111111111.eastus.aksapp.io:443

 FabricClient.discover_results  endpoint  { host: 'orderer2.1111111111111111111.eastus.aksapp.io',
  port: 443 }

initializeChannelFromDiscover.discoveryProtocol  grpcs  requesturl  grpcs://orderer2.1111111111111111111.eastus.aksapp.io:443

 FabricClient.discover_results  endpoint  { host: 'orderer3.1111111111111111111.eastus.aksapp.io',
  port: 443 }

initializeChannelFromDiscover.discoveryProtocol  grpcs  requesturl  grpcs://orderer3.1111111111111111111.eastus.aksapp.io:443

2020-07-08T16:15:37.490Z - error: [Remote.js]: Error: Failed to connect before the deadline URL:grpcs://localhost:443
SyncServices.synchNetworkConfigToDB client  first-network  channel_name  hrschannel
2020-07-08T16:15:40.744Z - error: [Remote.js]: Error: Failed to connect before the deadline URL:grpcs://localhost:443
<<<<<<<<<<<<<<<<<<<<<<<<<< Synchronizer Error >>>>>>>>>>>>>>>>>>>>>
Error: Orderer with name "orderer2.1111111111111111111.eastus.aksapp.io:443" not assigned to this channel
    at Channel.getOrderer (/home/css/delete/blockchain-explorer/node_modules/fabric-network/node_modules/fabric-client/lib/Channel.js:928:10)
    at FabricClient.switchOrderer (/home/css/delete/blockchain-explorer/app/platform/fabric/FabricClient.js:681:27)
    at FabricClient.getGenesisBlock (/home/css/delete/blockchain-explorer/app/platform/fabric/FabricClient.js:611:26)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
<<<<<<<<<<<<<<<<<<<<<<<<<< Closing client processor >>>>>>>>>>>>>>>>>>>>>
req.body { user: 'admin', password: 'adminpw', network: 'first-network' }
Network: first-network enableAuthentication false

Please help me to fix this issue.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,237 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Shruti Gupta 16 Reputation points
    2020-07-10T10:14:30.157+00:00

    Hi @selvam-7126,

    From the error log, it seems the explorer is trying to connect to localhost.

      2020-07-08T16:15:37.490Z - error: [Remote.js]: Error: Failed to connect before the deadline URL:grpcs://localhost:443
      SyncServices.synchNetworkConfigToDB client  first-network  channel_name  hrschannel
      2020-07-08T16:15:40.744Z - error: [Remote.js]: Error: Failed to connect before the deadline URL:grpcs://localhost:443
    

    As mentioned in blockchain explorer documentation, please set DISCOVERY_AS_LOCALHOST environment variable as false before starting the explorer.

    $ DISCOVERY_AS_LOCALHOST=false ./start.sh


  2. AshokPeddakotla-MSFT 27,966 Reputation points
    2020-07-15T11:55:23.467+00:00

    @selvam As specified in your Stack Overflow issue,

    At this moment, you can't fix this error because pem string format in connection profile is not supported by Explorer. But you'll be able to expect that Explorer supports it soon.

    We hope that answers your query. If you have further queries, please continue your discussion on the SO to avoid duplicate efforts.