Error while starting hyperledger explorer with fabric v1.2

2k views Asked by At

Getting the following error while starting explorer:

<<<<<<<<<<<<<<<<<<<<<<<<<< Explorer Error >>>>>>>>>>>>>>>>>>>>>
TypeError: Cannot read property 'size' of undefined
    at Platform.initialize (/home/kp/Desktop/blockchain-explorer/app/platform/fabric/Platform.js:52:45)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
Received kill signal, shutting down gracefully
Closed out connections

Using Fabric v1.2 and Explorer v0.3.6 I have replaced grpcs with grpc but that is also not helping much. Not sure on where to pass 'size' property in the config file.

{
   "network-configs":{
      "network-1":{
         "version":"1.0",
         "clients":{
            "client-1":{
               "tlsEnable":true,
               "organization":"Org1MSP",
               "channel":"mychannel",
               "credentialStore":{
                  "path":"./tmp/credentialStore_Org1/credential",
                  "cryptoStore":{
                     "path":"./tmp/credentialStore_Org1/crypto"
                  }
               }
            }
         },
         "channels":{
            "mychannel":{
               "peers":{
                  "peer0.org1.example.com":{
              }
           },
           "connection":{
              "timeout":{
                 "peer":{
                    "endorser":"6000",
                    "eventHub":"6000",
                    "eventReg":"6000"
                 }
              }
           }
        }
     },
     "organizations":{
        "Org1MSP":{
           "mspid":"Org1MSP",
           "fullpath":false,
           "adminPrivateKey":{
              "path":"/home/kp/Desktop/bct/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/"
           },
           "signedCert":{
              "path":"/home/kp/Desktop/bct/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/"
           }
        },
        "Org2MSP":{
           "mspid":"Org2MSP",
           "adminPrivateKey":{
              "path":"/home/kp/Desktop/bct/fabric-samples/first-network/crypto-config/peerOrganizations/org2.example.com/users/[email protected]/msp/keystore/"
           }
        },
        "OrdererMSP":{
           "mspid":"OrdererMSP",
           "adminPrivateKey":{
              "path":"/home/kp/Desktop/bct/fabric-samples/first-network/crypto-config/ordererOrganizations/example.com/users/[email protected]/msp/keystore/"
           }
        }
     },
     "peers":{
        "peer0.org1.example.com":{
           "tlsCACerts":{
              "path":"/home/kp/Desktop/bct/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
           },
           "url":"grpc://localhost:7051",
           "eventUrl":"grpc://localhost:7053",
           "grpcOptions":{
              "ssl-target-name-override":"peer0.org1.example.com"
           }
        },
        "peer1.org1.example.com":{
           "tlsCACerts":{
              "path":"/home/kp/Desktop/bct/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt"
           },
           "url":"grpc://localhost:8051",
           "eventUrl":"grpc://localhost:8053",
           "grpcOptions":{
              "ssl-target-name-override":"peer1.org1.example.com"
           }
        },
        "peer0.org2.example.com":{
           "tlsCACerts":{
              "path":"/home/kp/Desktop/bct/fabric-samples/first-network/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt"
           },
           "url":"grpc://localhost:9051",
           "eventUrl":"grpc://localhost:9053",
           "grpcOptions":{
              "ssl-target-name-override":"peer0.org2.example.com"
           }
        },
        "peer1.org2.example.com":{
           "tlsCACerts":{
              "path":"/home/kp/Desktop/bct/fabric-samples/first-network/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt"
           },
           "url":"grpc://localhost:10051",
           "eventUrl":"grpc://localhost:10053",
           "grpcOptions":{
              "ssl-target-name-override":"peer1.org2.example.com"
           }
        }
     },
     "orderers":{
        "orderer.example.com":{
           "url":"grpc://localhost:7050"
        }
     }
  },
  "network-2":{

  }

}, "configtxgenToolPath":"/home/kp/Desktop/bct/fabric-samples/bin/", "license":"Apache-2.0" }

3

There are 3 answers

0
nekia On
TypeError: Cannot read property 'size' of undefined
at Platform.initialize (/home/kp/Desktop/blockchain-explorer/app/platform/fabric/Platform.js:52:45)

According to Platform.js, it means to have been failed to load your config.json in some reason. You need to review with the following view points:

  • Check logs/app/app.log
  • Difference from orignal config.json

And I don't think it related to this problem, but you need to turn 'tlsEnable' in config.json into 'false' when disabling TLS.

{
   "network-configs": {
     "network-1": {
       "clients": {
         "client-1": {
           "tlsEnable": false,
                        ^^^^^
0
Thierry Grandjean On

I get the same error, on my side the tag "network-configs": was missing. In the console log, just before this error, I get a msg saying '******* Initialization started for hyperledger fabric platform ******,',undefined

If you checked the code in platform.js you can see that the undefined variable correspond to network-configs.

I created a simple config.json file in the original folder like the following :

{

"network-configs": {

    "first-network": {

        "name": "firstnetwork",

        "profile": "./connection-profile/first-network.json",

        "enableAuthentication": false

    }

},

"license": "Apache-2.0"

Than I created a full profile doc starting with

{

"name": "first-network",

"version": "1.0.0",

I am not sure if splitting the file is really necessary but anyway on my side this procedure fixed the issue.

1
Harry Dinh On

Do you have any solution for this problem? I deployed Hyperledger Explorer Step by Step with link https://github.com/hyperledger/blockchain-explorer and I got the same error with you I use with fabric v1.2 and composer v0.20.0