error while accessing Hyperldger explorer "Cannot GET /"

529 views Asked by At

I have configured our Fabric network (v1.4) with Explorer (latest version).

node --version v8.16.0

No errors in db log No application level errors Explorer syncing process is going on continuously for the network Able to view the updated data in DB http://localhost:8080/api-docs/ (Explorer Swagger) works fine. However while accessing http://localhost:8080/ i am getting

Cannot GET / error.

Chrome inspect logs -

Failed to load resource: the server responded with a status of http://localhost:8080/ 404 (Not Found)

console logs -

[2020-01-28T22:30:53.167] [INFO] PgService - SSL to Postgresql disabled
[2020-01-28T22:30:53.167] [INFO] PgService - connecting to Postgresql postgres://hppoc:******@127.0.0.1:5432/fabricexplorer
[2020-01-28T22:30:54.285] [INFO] Platform -  client_configs.name  first-network  client_configs.profile  ./connection-profile/first-network.json
[2020-01-28T22:30:54.285] [INFO] Platform - FabricUtils.createFabricClient
[2020-01-28T22:30:54.286] [INFO] FabricConfig - config.client.tlsEnable  true
[2020-01-28T22:30:54.287] [INFO] FabricGateway - peer0.org1.example.com
[2020-01-28T22:30:54.287] [INFO] FabricGateway - /path/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/[email protected]
adminPrivateKeyPath  /path/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/e65fa2dd29a69b2b28f9e439d1a8d555d411e9906e5a20d0a7341207a3a46424_sk
[2020-01-28T22:30:54.287] [INFO] FabricConfig - FabricConfig, this.config.channels  mychannel
[2020-01-28T22:30:54.607] [INFO] FabricClient -  FabricClient.discover_results  endpoint  { host: 'orderer.example.com', port: 7050 }
[2020-01-28T22:30:54.638] [INFO] Platform - FabricUtils.createDetachClient
[2020-01-28T22:30:54.640] [INFO] Platform - initializeListener, client_name, client  first-network { name: 'first-network',
  profile: './connection-profile/first-network.json' }
[2020-01-28T22:30:54.646] [INFO] main - Please open web browser to access :http://localhost:8080/
[2020-01-28T22:30:54.646] [INFO] main - pid is 18213
[2020-01-28T22:30:54.782] [INFO] PgService - SSL to Postgresql disabled
[2020-01-28T22:30:54.782] [INFO] PgService - connecting to Postgresql postgres://hppoc:******@127.0.0.1:5432/fabricexplorer
[2020-01-28T22:30:55.397] [INFO] SyncPlatform - Updating the client network and other details to DB
[2020-01-28T22:30:55.404] [INFO] SyncServices - SyncServices.synchNetworkConfigToDB client  first-network  channel_name  mychannel
[2020-01-28T22:30:55.427] [INFO] FabricClient -  FabricClient.discover_results  endpoint  { host: 'orderer.example.com', port: 7050 }
[2020-01-28T22:30:55.528] [INFO] SyncPlatform - Sync process is started for the network : [first-network] and client : [first-network]
[2020-01-28T22:30:55.530] [INFO] FabricConfig - config.client.tlsEnable  true
[2020-01-28T22:30:55.530] [INFO] FabricGateway - peer0.org1.example.com
[2020-01-28T22:30:55.530] [INFO] FabricGateway - /path/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/[email protected]
adminPrivateKeyPath  /path/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/e65fa2dd29a69b2b28f9e439d1a8d555d411e9906e5a20d0a7341207a3a46424_sk
[2020-01-28T22:30:55.530] [INFO] FabricConfig - FabricConfig, this.config.channels  mychannel
[2020-01-28T22:30:55.798] [INFO] FabricClient -  FabricClient.discover_results  endpoint  { host: 'orderer.example.com', port: 7050 }
[2020-01-28T22:30:55.833] [INFO] SyncServices - SyncServices.synchNetworkConfigToDB client  first-network  channel_name  mychannel
[2020-01-28T22:30:55.865] [INFO] FabricClient -  FabricClient.discover_results  endpoint  { host: 'orderer.example.com', port: 7050 }
[2020-01-28T22:30:55.883] [INFO] Sync - Synchronizer pid is 18220
[2020-01-28T22:30:55.901] [INFO] SyncServices - block_row.blocknum  4
[2020-01-28T22:30:58.200] [INFO] SyncPlatform - Updating the client network and other details to DB
[2020-01-28T22:30:58.209] [INFO] SyncServices - SyncServices.synchNetworkConfigToDB client  first-network  channel_name  mychannel
[2020-01-28T22:30:58.241] [INFO] FabricClient -  FabricClient.discover_results  endpoint  { host: 'orderer.example.com', port: 7050 }
2

There are 2 answers

0
Chinmay On BEST ANSWER

So, I found the answer to the problem - Weirdly the problem was it shows everywhere that it serves on localhost:8080 but after a lot of research found out that node js cannot serve static pages which hyperledger explorer is on port 8080. So, needs to use "serve" to build and serve that page. I had did that 2 days back, it starts on port 5000 and it`s own IP address, but I was getting error on web browser for violation of "control security policy".

Solution :

$ cd ~/Hyperledger/blockchain-explorer/client
$ npm install
$ npm test -- -u --coverage 
$ npm run build
$ npm install -g serve
$ serve -s build

Now it will show you the output something like :


   ┌────────────────────────────────────────────────────┐
   │                                                    │
   │   Serving!                                         │
   │                                                    │
   │   - Local:            http://localhost:5000        │
   │   - On Your Network:  http://160.33.244.178:5000   │
   │                                                    │
   │   Copied local address to clipboard!               │
   │                                                    │
   └────────────────────────────────────────────────────┘

If you open up : http://localhost:5000 it will not show anything and in the network logs on inspect window will show you - "control security policy violation".

so use port 8080 instead like this :

- Local:            http://localhost:8080        │
- On Your Network:  http://160.33.244.178:8080

Also, you would need to start the hyperldger explorer server :

$ cd ~/<YourPath>/blockchain-explorer
$ ./start.sh

You will see login page with first network selected.

Use :

"adminUser" is the the admin user of the network, in this case it's fabric CA or an identity user.
"adminPassword" is the password for the admin user.

and you are in !

1
Nick Latkovich On

If you start explorer using docker compose, that is in root of repo, then check your 8090 port, cause docker map 8080 port of container to 8090 port of your machine.

See github:hyperledger/blockain-explorer/docker-compose.yaml