Bob Dill
Bob Dill

Reputation: 1010

hyperledger_fabric first-network fails with BAD_REQUEST

This question is similar to First network in hyperledger except that I am attempting to run the automated scripts as described here: http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html rather than executing steps manually.

When I run the supplied scripts, I get the following output:

Build your first network (BYFN) end-to-end test

Channel name : mychannel
Creating channel...
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
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
2017-08-14 16:41:43.613 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2017-08-14 16:41:43.613 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2017-08-14 16:41:43.620 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2017-08-14 16:41:43.622 UTC [msp] GetLocalMSP -> DEBU 004 Returning existing local MSP
2017-08-14 16:41:43.622 UTC [msp] GetDefaultSigningIdentity -> DEBU 005 Obtaining default signing identity
2017-08-14 16:41:43.622 UTC [msp] GetLocalMSP -> DEBU 006 Returning existing local MSP
2017-08-14 16:41:43.622 UTC [msp] GetDefaultSigningIdentity -> DEBU 007 Obtaining default signing identity
2017-08-14 16:41:43.622 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0A8C060A074F7267314D53501280062D...53616D706C65436F6E736F727469756D 
2017-08-14 16:41:43.622 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: 19B305348F751FF3B0C1B71929C28A1C70F05748093E5A68E7DED43F7C3619ED 
2017-08-14 16:41:43.622 UTC [msp] GetLocalMSP -> DEBU 00a Returning existing local MSP
2017-08-14 16:41:43.622 UTC [msp] GetDefaultSigningIdentity -> DEBU 00b Obtaining default signing identity
2017-08-14 16:41:43.622 UTC [msp] GetLocalMSP -> DEBU 00c Returning existing local MSP
2017-08-14 16:41:43.622 UTC [msp] GetDefaultSigningIdentity -> DEBU 00d Obtaining default signing identity
2017-08-14 16:41:43.622 UTC [msp/identity] Sign -> DEBU 00e Sign: plaintext: 0AC3060A1508021A0608C7A5C7CC0522...E601917DB4E717688C2A98F6A85BB2C8 
2017-08-14 16:41:43.622 UTC [msp/identity] Sign -> DEBU 00f Sign: digest: 6C4EDDCB459279CFBB9D696D2179A95D00FE85F80E01375E94D4A66A50A9ABF5 
Error: Got unexpected status: BAD_REQUEST

In an attempt to resolve this, I have gone back to the beginning, removed all docker containers and images and restarted the process at the download platform specific image binaries step:

curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap-1.0.1.sh | bash

===> Please note, google shortened URL (goo.gl/eYdRbX) ran afoul of the stackoverflow editor, so has been replaced with the URL to which it points

Regardless, I still get the same BAD_REQUEST response at the same point in the first-network setup process. I am completely stalled until I can resolve this issue.

I do note that at the top of this script, where the different docker images are being created, that create cli appears twice, as do, later 'Recreating cli'. Don't know if this is related to this problem or not.

Creating network "net_byfn" with the default driver
Creating peer1.org2.example.com ... 
Creating peer1.org1.example.com ... 
Creating peer0.org2.example.com ... 
Creating peer0.org1.example.com ... 
Creating orderer.example.com ... 
Creating peer1.org2.example.com
Creating peer0.org2.example.com
Creating peer1.org1.example.com
Creating orderer.example.com
Creating peer1.org1.example.com ... done
Creating cli ... 
Creating cli ... done
WARNING: The DELAY variable is not set. Defaulting to a blank string.
peer1.org1.example.com is up-to-date
peer0.org2.example.com is up-to-date
orderer.example.com is up-to-date
peer1.org2.example.com is up-to-date
peer0.org1.example.com is up-to-date
Recreating cli ... 
Recreating cli ... done

docker ps -a results after executing load from (goo.gl/eYdRbX ):

===> List out hyperledger docker images
hyperledger/fabric-ca          latest              5f30bda5f7ee        4 days ago          238MB
hyperledger/fabric-ca          x86_64-1.0.1        5f30bda5f7ee        4 days ago          238MB
hyperledger/fabric-tools       latest              259847d24868        4 days ago          1.34GB
hyperledger/fabric-tools       x86_64-1.0.1        259847d24868        4 days ago          1.34GB
hyperledger/fabric-couchdb     latest              dd645e1e92c7        4 days ago          1.48GB
hyperledger/fabric-couchdb     x86_64-1.0.1        dd645e1e92c7        4 days ago          1.48GB
hyperledger/fabric-kafka       latest              cbdc916590a0        4 days ago          1.3GB
hyperledger/fabric-kafka       x86_64-1.0.1        cbdc916590a0        4 days ago          1.3GB
hyperledger/fabric-zookeeper   latest              eb07e5cc9674        4 days ago          1.31GB
hyperledger/fabric-zookeeper   x86_64-1.0.1        eb07e5cc9674        4 days ago          1.31GB
hyperledger/fabric-orderer     latest              bbf2708c9487        4 days ago          179MB
hyperledger/fabric-orderer     x86_64-1.0.1        bbf2708c9487        4 days ago          179MB
hyperledger/fabric-peer        latest              abb05def5cfb        4 days ago          182MB
hyperledger/fabric-peer        x86_64-1.0.1        abb05def5cfb        4 days ago          182MB
hyperledger/fabric-javaenv     latest              2bd60859415d        4 days ago          1.42GB
hyperledger/fabric-javaenv     x86_64-1.0.1        2bd60859415d        4 days ago          1.42GB
hyperledger/fabric-ccenv       latest              7e2019cf8174        4 days ago          1.29GB
hyperledger/fabric-ccenv       x86_64-1.0.1        7e2019cf8174        4 days ago          1.29GB

docker ps results:

c6025a23ab46        hyperledger/fabric-tools     "/bin/bash -c './s..."   13 seconds ago      Up 11 seconds                                                          cli
a132bd2f4fed        hyperledger/fabric-peer      "peer node start"        27 seconds ago      Up 25 seconds       0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp     peer0.org1.example.com
a9e9078c381c        hyperledger/fabric-orderer   "orderer"                27 seconds ago      Up 26 seconds       0.0.0.0:7050->7050/tcp                             orderer.example.com
48768f75bcb0        hyperledger/fabric-peer      "peer node start"        27 seconds ago      Up 26 seconds       0.0.0.0:9051->7051/tcp, 0.0.0.0:9053->7053/tcp     peer0.org2.example.com
bb14fd33c8a2        hyperledger/fabric-peer      "peer node start"        27 seconds ago      Up 26 seconds       0.0.0.0:10051->7051/tcp, 0.0.0.0:10053->7053/tcp   peer1.org2.example.com
f20582c065a0        hyperledger/fabric-peer      "peer node start"        27 seconds ago      Up 25 seconds       0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp     peer1.org1.example.com

Upvotes: 0

Views: 857

Answers (2)

Bob Dill
Bob Dill

Reputation: 1010

There's an extra line of code in the current version of the byfn.sh file for first-network. The networkUp function currently looks like this:

# Generate the needed certificates, the genesis block and start the network.

function networkUp () {
  # generate artifacts if they don't exist
  if [ ! -d "crypto-config" ]; then
    generateCerts
    replacePrivateKey
    generateChannelArtifacts
  fi
  CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT DELAY=$CLI_DELAY docker-compose -f $COMPOSE_FILE up -d 2>&1
  if [ "${IF_COUCHDB}" == "couchdb" ]; then
      CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH up -d 2>&1
  else
      CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT docker-compose -f $COMPOSE_FILE up -d 2>&1
  fi
  if [ $? -ne 0 ]; then
    echo "ERROR !!!! Unable to start network"
    docker logs -f cli
    exit 1
  fi
  docker logs -f cli
}

There are two errors in this exec. The first is line 113 in the current file, which issues a docker-compose request immediately prior to the test for IF_COUCHDB. This line should be removed/commented out. The second error in this exec is that the DELAY argument is not being set for either of the docker-compose requests in the if statement. The code for this exec should be updated to the following:

# Generate the needed certificates, the genesis block and start the network.
function networkUp () {
  # generate artifacts if they don't exist
  if [ ! -d "crypto-config" ]; then
    generateCerts
    replacePrivateKey
    generateChannelArtifacts
  fi
#  CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT DELAY=$CLI_DELAY docker-compose -f $COMPOSE_FILE up -d 2>&1
  if [ "${IF_COUCHDB}" == "couchdb" ]; then
      CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT DELAY=$CLI_DELAY docker-compose -f $COMPOSE_FILE -f $COMPOSE_FILE_COUCH up -d 2>&1
  else
      CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT DELAY=$CLI_DELAY docker-compose -f $COMPOSE_FILE up -d 2>&1
  fi
  if [ $? -ne 0 ]; then
    echo "ERROR !!!! Unable to start network"
    docker logs -f cli
    exit 1
  fi
  docker logs -f cli
} 

Here you can see that the extra docker-compose statement (line 113) has been commented out and the DELAY argument is now being passed correctly to the docker-compose request.

Upvotes: 0

ajp
ajp

Reputation: 401

Run configtxgen --version, is the output 1.0.0 or 1.0.1?

Version 1.0.0 doesn't include the mod_policy stuff required to make the 1.0.1 images work, you'll need to redownload the tools.

If the output is 1.0.1, can you please re-run through everything manually, except when you get to bringing the containers up:

CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=<pick_a_value> docker-compose -f docker-compose-cli.yaml up -d

make sure to run it without the -d argument at the end, so the command is now:

CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=<pick_a_value> docker-compose -f docker-compose-cli.yaml up

This will display the logs in the terminal. Now open a new terminal tab and set your env variables again (i.e. CHANNEL_NAME and FABRIC_CFG_PATH) and continue the manual setup. When you run the channel creation command:

peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem

Look at the last few lines of the log on the other tab and post them here.

Upvotes: 4

Related Questions