Running hlf 1.4 and latest explorer in kubernetes. Explorer hangs in the start phase where it tries to reach peers. It doesn't reach the code were it starts web interface.
Peer has chaincode installed, connected to channel, no issues.
I have disabled TLS to make investigation easier and put logs in Channel.js, Peer.js in explorer dependencies to better investigate it.
I have added log to Channel.js in /blockchain-explorer/node_modules/fabric-client/lib/Channel.js to print connect to target and I can see that it shows grpc://localhost:undefined. I believe it tries to send request to invalid address and silently dies. Entire file https://gist.github.com/gad0lin/51384bfea1c207ccf016a0cad8e413b6#file-channel-js-L3474.
[{"_options":"1","_url":"2","_endpoint":"3","_name":"4","_request_timeout":45000,"_grpc_wait_for_ready_timeout":3000,
"_endorserClient":"5","_discoveryClient":"6"},{"name":"4","grpc.ssl_target_name_override":"4","grpc.default_authority":"4","grpc.max_receive_message_length":-1,"grpc.max_send_message_length":-1},"grpc://localhost:undefined",{"addr":"7","creds":"8"},"peer1-hlf-peer.peers.svc.cluster.local",
{"$interceptors":"9","$interceptor_providers":"10","$channel":"11"},{"$interceptors":"12","$interceptor_providers":"13","$channel":"14"},"localhost",{},[],[],{},[],[],{}]
Here is hlf config:
{
"network-configs": {
"network-1": {
"version": "1.0",
"clients": {
"cli": {
"tlsEnable": false,
"organization": "Org1MSP",
"channel": "mychannel",
"credentialStore": {
"path": "./tmp/credentialStore_Org1/credential",
"cryptoStore": {
"path": "./tmp/credentialStore_Org1/crypto"
}
}
}
},
"channels": {
"mychannel": {
"peers": {
"peer1-hlf-peer.peers.svc.cluster.local": {}
},
"connection": {
"timeout": {
"peer": {
"endorser": "30",
"eventHub": "30",
"eventReg": "30"
}
}
}
}
},
"organizations": {
"Org1MSP": {
"certificateAuthorities": ["fabric-ca"],
"mspid": "Org1MSP",
"fullpath": true,
"adminPrivateKey": {
"path": "/var/hyperledger/msp/admincerts/key.pem"
},
"signedCert": {
"path": "/var/hyperledger/msp/admincerts/cert.pem"
}
}
},
"peers": {
"peer1-hlf-peer.peers.svc.cluster.local": {
"url": "grpc://peer1-hlf-peer.peers.svc.cluster.local:7051",
"eventUrl": "grpc://peer1-hlf-peer.peers.svc.cluster.local:7053",
"grpcOptions": {
"ssl-target-name-override": "peer1-hlf-peer.peers.svc.cluster.local"
}
}
},
"orderers": {
"ord1-hlf-ord.orderers.svc.cluster.local" : {
"url":"grpc://ord1-hlf-ord.orderers.svc.cluster.local:7050"
}
},
"certificateAuthorities": {
"fabric-ca": {
"url": "http://ca-hlf-ca.cas.svc.cluster.local:7054",
"httpOptions":{
"verify": false
},
"registrar": {
"enrollId": "admin",
"enrollSecret": "adminpw"
},
"caName": "ca"
}
}
}
}
}{
"persistence": "postgreSQL",
"platforms": ["fabric"],
"postgreSQL": {
"host": "explorer-db.x.svc.cluster.local",
"port": "5432",
"database": "fabricexplorer",
"username": "hppoc",
"passwd": "password"
},
"sync": {
"type": "local",
"platform": "fabric",
"blocksSyncTime": "3"
}
}
I found the culprit. There were two issues.
I didn't set environment variable DISCOVERY_AS_LOCALHOST to false in explorer config. That was the reason I saw: localhost.
In peer I had set variable CORE_PEER_GOSSIP_EXTERNALENDPOINT, but without port. That was the reason I saw undefined as port.