I have deployed a simple business network using fabric-dev-servers. Everything is working fine but i am trying to integrate explorer with it. I have installed everything as it has been defined in the docs available at github. But explorer fails to start on browser. And gives error "" Failed to render one or more components".
App logs
[2018-08-15 15:10:13.639] [DEBUG] FabricConfiguration - Msp ID : Org1MSP
[2018-08-15 15:10:13.656] [DEBUG] FabricConfiguration - Msp ID : Org1MSP
[2018-08-15 15:10:13.716] [INFO] main - Please set logger.setLevel to DEBUG in ./app/helper.js to log the debugging.
[2018-08-15 15:10:13.716] [INFO] main - Please set logger.setLevel to DEBUG in ./app/helper.js to log the debugging.
[2018-08-15 15:10:13.803] [DEBUG] Query - ===========================================
[2018-08-15 15:10:13.803] [DEBUG] Query - ByteBuffer {
buffer: <Buffer 08 0d 12 20 a2 c2 55 58 27 1b 18 f2 c7 28 37 b6 22 d0 d9 7c d6 12 6e f6 99 49 db 8b bd fe 52 cc 03 3c af 55 1a 20 31 7a 96 7f 57 92 da d3 fa 64 34 94 ... >,
offset: 4,
markedOffset: -1,
limit: 36,
littleEndian: true,
noAssert: false }
[2018-08-15 15:10:13.805] [DEBUG] Query - ===========================================
[2018-08-15 15:10:13.829] [DEBUG] Query - ===========================================
[2018-08-15 15:10:13.829] [DEBUG] Query - ByteBuffer {
buffer: <Buffer 08 0d 12 20 a2 c2 55 58 27 1b 18 f2 c7 28 37 b6 22 d0 d9 7c d6 12 6e f6 99 49 db 8b bd fe 52 cc 03 3c af 55 1a 20 31 7a 96 7f 57 92 da d3 fa 64 34 94 ... >,
offset: 4,
markedOffset: -1,
limit: 36,
littleEndian: true,
noAssert: false }
[2018-08-15 15:10:13.829] [DEBUG] Query - ===========================================
[2018-08-15 15:10:13.854] [DEBUG] Query - <<< Instantiated Chaincodes >>>
[2018-08-15 15:10:13.854] [DEBUG] Query - name: examplebnasample, version: 0.0.2-deploy.52, path: /tmp/businessnetwork118713-16936-2rd8kb.v1444
[2018-08-15 15:15:15.137] [ERROR] metricservice - TypeError: Cannot read property 'length' of null
at MetricService.getPeerData (/home/saeedi/blockchain-explorer/app/persistence/postgreSQL/MetricService.js:36:32)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
[2018-08-15 15:15:15.142] [DEBUG] platform - GetStatus All! [ { status: 'DOWN', server_hostname: undefined } ]
[2018-08-15 15:17:53.308] [ERROR] metricservice - TypeError: Cannot read property 'length' of null
at MetricService.getPeerData (/home/saeedi/blockchain-explorer/app/persistence/postgreSQL/MetricService.js:36:32)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
[2018-08-15 15:17:53.309] [DEBUG] platform - GetStatus All! [ { status: 'DOWN', server_hostname: undefined } ]
[2018-08-15 15:22:23.206] [ERROR] metricservice - TypeError: Cannot read property 'length' of null
at MetricService.getPeerData (/home/saeedi/blockchain-explorer/app/persistence/postgreSQL/MetricService.js:36:32)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
[2018-08-15 15:22:23.208] [DEBUG] platform - GetStatus All! [ { status: 'DOWN', server_hostname: undefined } ]
DB logs
[2018-08-15 15:26:28.448] [DEBUG] pgservice - the getRowsBySQlNoCondtion select c.name as chaincodename,channel.name as channelname ,c.version as version,c.genesis_block_hash as genesis_block_hash,c.path as path ,txcount as c from chaincodes as c inner join channel on c.genesis_block_hash=channel.genesis_block_hash where c.genesis_block_hash='undefined'
[2018-08-15 15:26:28.451] [DEBUG] pgservice - the getRowsBySQlNoCondtion select c.id as id,c.name as channelname,c.blocks as blocks ,c.genesis_block_hash as genesis_block_hash,c.trans as transactions,c.createdt as createdat,c.channel_hash as channel_hash from channel c
group by c.id ,c.name ,c.blocks ,c.trans ,c.createdt ,c.channel_hash,c.genesis_block_hash order by c.name
[2018-08-15 15:26:28.452] [DEBUG] pgservice - the getRowsBySQlCase select count(1) c from chaincodes where genesis_block_hash='undefined'
[2018-08-15 15:26:28.453] [DEBUG] pgservice - the getRowsBySQlNoCondtion select channel.name as channelname,c.requests as requests,c.genesis_block_hash as genesis_block_hash ,c.server_hostname as server_hostname from peer as c inner join channel on c.genesis_block_hash=channel.genesis_block_hash where c.genesis_block_hash='undefined'
[2018-08-15 15:26:28.457] [DEBUG] pgservice - the getRowsBySQlCase select count(1) c from transactions where genesis_block_hash='undefined'
[2018-08-15 15:26:28.460] [DEBUG] pgservice - the getRowsBySQlQuery select count(creator_msp_id), creator_msp_id
from transactions
where genesis_block_hash ='undefined'
group by creator_msp_id
[2018-08-15 15:26:28.461] [DEBUG] pgservice - the getRowsBySQlCase select count(1) c from blocks where genesis_block_hash='undefined'
[2018-08-15 15:26:28.463] [DEBUG] pgservice - the getRowsBySQlQuery select t.creator_msp_id,t.txhash,t.type,t.chaincodename,t.createdt,channel.name as channelname from transactions as t inner join channel on t.genesis_block_hash=channel.genesis_block_hash where t.blockid >= 0 and t.id >= 0 and
t.genesis_block_hash = 'undefined' order by t.id desc
[2018-08-15 15:26:28.464] [DEBUG] pgservice - the getRowsBySQlQuery with hours as (
select generate_series(
date_trunc('hour', now()) - '1day'::interval,
date_trunc('hour', now()),
'1 hour'::interval
) as datetime
)
select
hours.datetime,
count(createdt)
from hours
left join TRANSACTIONS on date_trunc('hour', TRANSACTIONS.createdt) = hours.datetime and genesis_block_hash ='undefined'
group by 1
order by 1
[2018-08-15 15:26:28.465] [DEBUG] pgservice - the getRowsBySQlCase select count(1) c from peer where genesis_block_hash='undefined'
[2018-08-15 15:26:28.468] [DEBUG] pgservice - the getRowsBySQlQuery with minutes as (
select generate_series(
date_trunc('min', now()) - '1hour'::interval,
date_trunc('min', now()),
'1 min'::interval
) as datetime
)
select
minutes.datetime,
Config.json
{
"network-config": {
"Org1": {
"name": "peerOrg1",
"mspid": "Org1MSP",
"peer1": {
"requests": "grpc://127.0.0.1:7051",
"events": "grpc://127.0.0.1:7053",
"server-hostname": "peer0.org1.example.com"
},
"admin": {
"key": "/home/saeedi/fabric-dev-servers/fabric-scripts/hlfv12/composer/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore",
"cert": "/home/saeedi/fabric-dev-servers/fabric-scripts/hlfv12/composer/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts"
}
}
},
"channel": "composerchannel",
"orderers":[
{
"mspid": "OrdererMSP",
"server-hostname":"orderer.example.com",
"requests":"grpc://127.0.0.1:7050"
}
],
"keyValueStore": "/tmp/fabric-client-kvs",
"configtxgenToolPath": "fabric-path/fabric-samples/bin",
"SYNC_START_DATE_FORMAT":"YYYY/MM/DD",
"syncStartDate":"2018/01/01",
"eventWaitTime": "30000",
"license": "Apache-2.0",
"version": "1.1"
}
App Logs After correcting organization and channel name
[2018-08-17 12:57:44.387] [ERROR] Query - TypeError: Cannot read property 'queryChannels' of undefined
at Proxy.queryChannels (/home/saeedi/blockchain-explorer/app/platform/fabric/Proxy.js:233:40)
at Platform.setChannels (/home/saeedi/blockchain-explorer/app/platform/fabric/Platform.js:186:35)
at Platform.initialize (/home/saeedi/blockchain-explorer/app/platform/fabric/Platform.js:151:16)
at Function.build (/home/saeedi/blockchain-explorer/app/platform/PlatformBuilder.js:13:28)
at platformroutes (/home/saeedi/blockchain-explorer/app/explorer/rest/platformroutes.js:17:36)
at Explorer.initialize (/home/saeedi/blockchain-explorer/app/explorer/Explorer.js:37:17)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
I think the first error is in the 4th line of your config.json file - the Org name is Org1:
"name": "Org1",
The other error I see for the default channel name for a Fabric created with fabric-dev-servers scripts is composerchannel:
"channel": "composerchannel",
After making these changes I would suggest re-running the 2 DB scripts to re-create the databases, before starting the explorer again.
I have it running with Composer v0.20.0, Fabric v1.2 and hyperledger-explorer v0.3.3
Updated to Include Config Sample: