7

From fabric document create-join-channel, when I execute the 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

it return error snippet following message:

2017-08-16 01:34:13.902 UTC [msp] GetLocalMSP -> DEBU 00c Returning existing local MSP 2017-08-16 01:34:13.902 UTC [msp] GetDefaultSigningIdentity -> DEBU 00d Obtaining default signing identity 2017-08-16 01:34:13.902 UTC [msp/identity] Sign -> DEBU 00e Sign: plaintext: 0AC3060A1508021A060895C2CECC0522...7E2E59E3CFD14AC765C92FBF36614E79 2017-08-16 01:34:13.902 UTC [msp/identity] Sign -> DEBU 00f Sign: digest: FA75790826EF23E1A7C46AD3B9AE0DB7321DC271B8BE93A29BAC2F6EEACBB8B0 Error: Got unexpected status: BAD_REQUEST Usage: peer channel create [flags]

Flags:

The commands are as follows:

cryptogen generate --config=./crypto-config.yaml

export FABRIC_CFG_PATH=$PWD

configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block

export CHANNEL_NAME=mychannel

configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID $CHANNEL_NAME

configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org1MSP

configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org2MSP

CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=10000 docker-compose -f docker-compose-cli.yaml up -d

docker exec -it cli bash

export CHANNEL_NAME=mychannel

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
Michael Piefel
  • 18,660
  • 9
  • 81
  • 112
Jim Green
  • 1,088
  • 3
  • 15
  • 40
  • Could you delete all the containers and run the execution again?! Are you executing the './byfn.sh -m up' command? If you are generating manually the artifacts, you mustn't execute the './byfn.sh -m up' command. – Urko Aug 23 '17 at 09:57

8 Answers8

1

Got unexpected status: BAD_REQUEST

Unfortunately, this error message can mean many things. FYI, in the upcoming fabric v1.1 release, this message has been enhanced to include additional text.

Most commonly, for channel creation, this status indicates that the submitter does not have channel creation rights (which usually equates to admin authority for an org). However, as mac indicates, if the channel already exists you might also get this error.

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

This command strikes me as the likely culprit. This command should usually be paired with lines like:

export CORE_PEER_MSPCONFIGPATH=`pwd`/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp 
export CORE_PEER_LOCALMSPID=PeerOrg1 

Which tell the peer command that the channel creation request should be signed using a particular admin's certificate. The default paths for the peer command's certificate material usually result in a standard user cert being used to sign.

Jason Yellick
  • 1,584
  • 9
  • 12
  • I am getting the same error message as Jim. I ran the same steps as him and also your suggestion with ``pwd`` - none of them work and I get `BAD_REQUEST` every time. I tried with different channel names (including ones that were never created before) and I make sure to run `byfn.sh -m down` before trying the commands. Any other ideas? – MisterStrickland Oct 19 '17 at 03:47
0

Please make sure that channel name is new one and that there is no existing channel already with that name in the network.

for example, if you already created a channel with CHANNEL_NAME=mychannel, change the variable before you create another channel, by running something like export CHANNEL_NAME=mychannelanother

adnan.c
  • 721
  • 5
  • 15
  • 1
    hmm, not sure what you mean. if you did byfn down command before you create a channel, it should work with the same channel name. Maybe you can give a list of commands you executed and what didn't work (with the error msg) and then people can take a look and help. – adnan.c Aug 16 '17 at 14:27
  • It should, what did you change in between? – christo4ferris Aug 17 '17 at 22:44
  • I tried doing this with different channel names (never created before) and always get the same result (`BAD_REQUEST`) – MisterStrickland Oct 19 '17 at 03:48
0

The reason you're getting this is probably because the docker-compose-cli.yaml file is still running the script.sh script. Comment out the line that invokes the script and it will run fine. Example:

# Comment out the line like the example below by adding a #
# command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME} ${DELAY} ${LANG}; sleep $TIMEOUT'```

I am suggesting a documentation change to fix this.

MisterStrickland
  • 947
  • 1
  • 15
  • 35
0

I had similar error. There seems to be a issue with the way CHANNEL_NAME variable is set within the docker-compose (I guess?). I ran this command with a slight modification as below [changed flag '-c $CHANNEL_NAME' to '-c mychannel']:

peer channel create -o orderer.example.com:7050 -c mychannel -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

This worked.

0

As @Phil said, you should comment out that line before you start the network. As documentation says :

If left uncommented, that script will exercise all of the CLI commands when the network is started, as we describe in the What’s happening behind the scenes? section. However, we want to go through the commands manually in order to expose the syntax and functionality of each call.

see the doc

omer.ersoy
  • 324
  • 1
  • 10
0

The same thing happens to me but I just down the network and then done all procedure again like generate genesis block again and then up my network I got up a network.

Hardik Gajjar
  • 1,024
  • 12
  • 27
0

Try adding a entry in the /etc/hosts for the domain in use (usually example.com)

go to terminal: type "sudo /etc/hosts" in the top add in "127.0.0.1 example.com" press ctrl+o to save, confirm with 'y', press ctrl+x to exit.

try again.. should work.

0
./byfn.sh -m restart -c mychannel
node_modules
  • 4,790
  • 6
  • 21
  • 37
Tim Kozak
  • 4,026
  • 39
  • 44