Sudeep
Sudeep

Reputation: 431

Hyperledger Fabric configtxgen - Error reading config: map merge requires map or sequence of maps as the value

I'm trying to setup a simple Fabric network with the following:

After generating the all the necessary files using cryptogen tool, running the configtxgen command gives the following error:

student@abc:~/Desktop/fabric/network$ configtxgen -profile DefaultBlockOrderingService -outputBlock ./config/genesis.block -configPath $PWD
    2019-12-26 12:35:42.131 MST [common.tools.configtxgen] main -> WARN 001 Omitting the channel ID for configtxgen for output operations is deprecated.  Explicitly passing the channel ID will be required in the future, defaulting to 'testchainid'.
    2019-12-26 12:35:42.136 MST [common.tools.configtxgen] main -> INFO 002 Loading configuration
    2019-12-26 12:35:42.137 MST [common.tools.configtxgen.localconfig] Load -> PANI 003 Error reading configuration:  While parsing config: yaml: map merge requires map or sequence of maps as the value
    2019-12-26 12:35:42.137 MST [common.tools.configtxgen] func1 -> PANI 004 Error reading configuration:  While parsing config: yaml: map merge requires map or sequence of maps as the value
    panic: Error reading configuration:  While parsing config: yaml: map merge requires map or sequence of maps as the value [recovered]
        panic: Error reading configuration:  While parsing config: yaml: map merge requires map or sequence of maps as the value

Here is the configtx.yaml

Organizations:
    - &abccoinOrderers
        Name: abccoinOrderersMSP
        ID: abccoinOrderersMSP
        MSPDir: crypto-config/ordererOrganizations/abccoin.com/msp
    - &ABC
        Name: ABCMSP
        ID: ABCMSP
        MSPDir: crypto-config/peerOrganizations/ABC.abccoin.com/msp
        AnchorPeers:
          - Host: Andy.ABC.abccoin.com
            Port: 7051

Application: &ApplicationDefaults

Orderer:
    - &DevModeOrdering
        OrdererType: solo
        Addresses:  
            - Devorderer.abccoin.com:7050
        BatchTimeout: 2s
        BatchSize:
            MaxMessageCount: 1

Profiles:
    DefaultBlockOrderingService:
        Orderer:
            <<: *DevModeOrdering
            Organizations:
                - *abccoinOrderers
        Consortiums:
            SampleConsortium:
                Organizations:
                    - *ABC


    abcMembersOnly:
        Consortium: SampleConsortium
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *ABC

I've already tried rearranging the code blocks as mentioned in this post. I've also tried pacing the "<<" key in quotes as mentioned in this issue YML document "<<: value" cannot be parsed #245 but it didn't help.

Upvotes: 3

Views: 2611

Answers (1)

Shubham Chadokar
Shubham Chadokar

Reputation: 2763

There are 2 errors in theconfigtx.yaml.

  1. Orderer: Is a map type or object type, not an array or slice type. When you define parameters using -, it is used as an array in yaml.
Orderer:
    // remove -
    &DevModeOrdering
      OrdererType: solo
      Addresses:  
          - Devorderer.abccoin.com:7050
      BatchTimeout: 2s
      BatchSize:
          MaxMessageCount: 1
  1. Application: You must declare Organizations: parameter. It can be empty. If you don't declare anything in that, it will not compile. To check you should try to convert the yaml into json in any online convertor.
Application: &ApplicationDefaults
    Organizations:

Upvotes: 2

Related Questions