Problem
I was following this Hyperledger Fabric tutorial: Building Your First Network
It explains about two ways to build and start your network.
One is via a shell script called byfn.sh which is simple to use and runs all the commands at once.
The other approach is running each and every command manually. This way, we get to know the process flow and step-by-step process of building the blockchain network.
I was following the manual approach and when I ran the following command to create peer channel:
peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
I got the following error message:
[configtx/tool/localconfig] Load -> CRIT 002 Error reading configuration: Unsupported Config Type “”
panic: Error reading configuration: Unsupported Config Type “”
Solution
Regarding this error, the troubleshooting section in the Build Your First Network tutorial page says the following:
If you are getting this error then the probable cause is:
– You did not set the
FABRIC_CFG_PATH
environment variable properly.
– The configtxgen tool needs this variable in order to locate theconfigtx.yaml
.
– Go back and execute anexport FABRIC_CFG_PATH=$PWD
, then recreate your channel artifacts.
In my case, I had set the FABRIC_CFG_PATH
environment variable correctly.
When I echo the FABRIC_CFG_PATH, then it shows the directory path of the fabric-samples/first-network
directory where I am working on right now.
echo $FABRIC_CFG_PATH;
The actual cause of this error in my case was that I was not inside the CLI container to execute the peer channel create command.
You need to enter the CLI container using the docker exec
command:
docker exec -it cli bash
If successful you should see the following:
root@0d78bb69300d:/opt/gopath/src/github.com/hyperledger/fabric/peer#
Over there, you should run the peer channel create command like this:
root@0d78bb69300d:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
Before running this command, please note that you should also run commands for creating environment variables for CHANNEL_NAME and other Environment variables for PEER0 within this CLI Container. They are present just above the peer channel create
command in the Build Your First Network tutorial page.
# Environment variables for PEER0 export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp export CORE_PEER_ADDRESS=peer0.org1.example.com:7051 export CORE_PEER_LOCALMSPID="Org1MSP" export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt export CHANNEL_NAME=mychannel
Hope this helps. Thanks.