httphyperledger-fabrichyperledgerhyperledger-fabric-orderer

Hyperledger Fabric: Joining an orderer to a channel fails with "http: request body too large"


I create a channel genesis block with

configtxgen \
    -profile ${CHANNEL_PROFILE} \
    -configPath ./artifacts/config \
    -outputBlock artifacts/channels/${CHANNEL_NAME}/${CHANNEL_NAME}.block \
    -channelID ${CHANNEL_NAME}

which is successful. Then I attempt to add an orderer to the channel with this command:

osnadmin channel join \
    --channelID=telemetry \
    --config-block ./artifacts/channels/telemetry/telemetry.block \
    -o localhost:7055 \
    --ca-file ${CA_FILE} \
    --client-cert ${CLIENT_CERT} \
    --client-key ${CLIENT_KEY}

and get the following response:

Status: 400
{
        "error": "cannot read form from request body: multipart: NextPart: http: request body too large"
}

My configtx.yaml:

Organizations:

    - &faa
        Name: faa
        SkipAsForeign: false
        ID: faaMSP
        MSPDir: ../../artifacts/crypto/faa.uam.nasa.gov/msp
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('faaMSP.admin', 'faaMSP.peer', 'faaMSP.client')"
            Writers:
                Type: Signature
                Rule: "OR('faaMSP.admin', 'faaMSP.peer', 'faaMSP.client')"
            Admins:
                Type: Signature
                Rule: "OR('faaMSP.admin')"
            Endorsement:
                Type: Signature
                Rule: "OR('faaMSP.peer')"
        OrdererEndpoints:
                - orderer0.faa.uam.nasa.gov:7050
        AnchorPeers:
            - Host: peer0.faa.uam.nasa.gov
              Port: 7051
    - &air-taxi-service
        Name: air-taxi-service
        SkipAsForeign: false
        ID: air-taxi-serviceMSP
        MSPDir: ../../artifacts/crypto/air-taxi-service.uam.nasa.gov/msp
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('air-taxi-serviceMSP.admin', 'air-taxi-serviceMSP.peer', 'air-taxi-serviceMSP.client')"
            Writers:
                Type: Signature
                Rule: "OR('air-taxi-serviceMSP.admin', 'air-taxi-serviceMSP.peer', 'air-taxi-serviceMSP.client')"
            Admins:
                Type: Signature
                Rule: "OR('air-taxi-serviceMSP.admin')"
            Endorsement:
                Type: Signature
                Rule: "OR('air-taxi-serviceMSP.peer')"
        OrdererEndpoints:
                - orderer0.faa.uam.nasa.gov:7050
        AnchorPeers:
            - Host: peer0.air-taxi-service.uam.nasa.gov
              Port: 8051

Capabilities:
    Channel: &ChannelCapabilities
        V2_0: true
    Orderer: &OrdererCapabilities
        V2_0: true
    Application: &ApplicationCapabilities
        V2_0: true

Application: &ApplicationDefaults
    Organizations:
    Policies:
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        Admins:
            Type: ImplicitMeta
            Rule: "ANY Admins"
        LifecycleEndorsement:
            Type: ImplicitMeta
            Rule: "MAJORITY Endorsement"
        Endorsement:
            Type: ImplicitMeta
            Rule: "MAJORITY Endorsement"

    Capabilities:
        <<: *ApplicationCapabilities

Orderer: &OrdererDefaults
    OrdererType: etcdraft
    EtcdRaft:
        Consenters:
        - Host: orderer0.faa.uam.nasa.gov
          Port: 7050
          ClientTLSCert: ../../artifacts/crypto/faa.uam.nasa.gov/peers/orderer0.faa.uam.nasa.gov/tls/server.crt
          ServerTLSCert: ../../artifacts/crypto/faa.uam.nasa.gov/peers/orderer0.faa.uam.nasa.gov/tls/server.crt
    BatchTimeout: 2s
    BatchSize:
        MaxMessageCount: 20
        AbsoluteMaxBytes: 99 MB
        PreferredMaxBytes: 512 KB
    Organizations:
    Policies:
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"
        BlockValidation:
            Type: ImplicitMeta
            Rule: "ANY Writers"

Channel: &ChannelDefaults
    Policies:
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"
    Capabilities:
        <<: *ChannelCapabilities

Profiles:
  UAMProfile:
        <<: *ChannelDefaults
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *faa
                - *air-taxi-service
            Capabilities:
                <<: *ApplicationCapabilities
        Orderer:
            <<: *OrdererDefaults
            Organizations:
                - *faa
            Capabilities:
                <<: *OrdererCapabilities

My orderer.yaml file:

---
General:
    ListenAddress: 0.0.0.0
    ListenPort: 7050
    TLS:
        Enabled: true
        PrivateKey: /var/hyperledger/orderer/tls/server.key
        Certificate: /var/hyperledger/orderer/tls/server.crt
        RootCAs:
        ClientAuthRequired: false
        ClientRootCAs:
    Keepalive:
        ServerMinInterval: 60s
        ServerInterval: 7200s
        ServerTimeout: 20s
    Cluster:
        SendBufferSize: 50
        ClientCertificate:
        # ClientPrivateKey governs the file location of the private key of the client TLS certificate.
        ClientPrivateKey:
        ListenPort:
        ListenAddress:
        ServerCertificate:
        ServerPrivateKey:
    BootstrapMethod: none
    BootstrapFile:
    LocalMSPDir: /var/hyperledger/orderer/msp
    LocalMSPID: faaMSP
    Profile:
        Enabled: false
        Address: 0.0.0.0:6060
    BCCSP:
        Default: SW
        SW:
            Hash: SHA2
            Security: 256
            FileKeyStore:
                KeyStore:
        PKCS11:
            Library:
            Label:
            Pin:
            Hash:
            Security:
            FileKeyStore:
                KeyStore:
    Authentication:
        TimeWindow: 15m

FileLedger:
    Location: /var/hyperledger/production/orderer
    Prefix: hyperledger-fabric-ordererledger
Kafka:
    Retry:
        ShortInterval: 5s
        ShortTotal: 10m
        LongInterval: 5m
        LongTotal: 12h
        NetworkTimeouts:
            DialTimeout: 10s
            ReadTimeout: 10s
            WriteTimeout: 10s
        Metadata:
            RetryBackoff: 250ms
            RetryMax: 3
        Producer:
            RetryBackoff: 100ms
            RetryMax: 3
        Consumer:
            RetryBackoff: 2s
    Topic:
        ReplicationFactor: 3
    Verbose: false
    TLS:
      Enabled: false
      PrivateKey:
        #File: path/to/PrivateKey
      Certificate:
        #File: path/to/Certificate
      RootCAs:
        #File: path/to/RootCAs
    SASLPlain:
      Enabled: false
      User:
      Password:
    Version:

Debug:
    BroadcastTraceDir:
    DeliverTraceDir:

Operations:
    ListenAddress: 127.0.0.1:8443
    TLS:
        Enabled: false
        Certificate:
        PrivateKey:
        ClientAuthRequired: false
        ClientRootCAs: []

Metrics:
    Provider: disabled
    Statsd:
      Network: udp
      Address: 127.0.0.1:8125
      WriteInterval: 30s
      Prefix:

Consensus:
    WALDir: /var/hyperledger/production/orderer/etcdraft/wal
    SnapDir: /var/hyperledger/production/orderer/etcdraft/snapshot

Admin:
  ListenAddress: 0.0.0.0:7055
  TLS:
    Enabled: true
    PrivateKey: /var/hyperledger/orderer/tls/server.key
    Certificate: /var/hyperledger/orderer/tls/server.crt
    ClientAuthRequired: true
    ClientRootCAs: /var/hyperledger/orderer/users/admin0@faa.uam.nasa.gov/msp/cacerts/localhost-7054-ca-faa.uam.nasa.gov.pem

ChannelParticipation:
  Enabled: true

My orderer-docker-compose.yaml file:

version: "2"

networks:
  uam.nasa.gov:

services:
  orderer0.faa.uam.nasa.gov:
    container_name: orderer0.faa.uam.nasa.gov
    image: hyperledger/fabric-orderer:2.3
    dns_search: .
    environment:
      - ORDERER_GENERAL_LOGLEVEL=INFO
      - FABRIC_LOGGING_SPEC=INFO
      - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
      # - ORDERER_GENERAL_GENESISMETHOD=file
      # - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/orderer/genesis.block
      - ORDERER_GENERAL_LOCALMSPID=faaMSP
      - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
      - ORDERER_GENERAL_TLS_ENABLED=true
      - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
      - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
      - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
      - ORDERER_GENERAL_LISTENPORT=7050
      - ORDERER_GENERAL_BOOTSTRAPMETHOD=none
      - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7055
      - ORDERER_ADMIN_TLS_ENABLED=true
      - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
      - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
      - ORDERER_ADMIN_TLS_CLIENTAUTHREQUIRED=true
      - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/admin/tls/ca.crt]
      - FABRIC_CFG_PATH=/var/hyperledger/config
      - ORDERER_CHANNELPARTICIPATION_ENABLED=true
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/orderers
    command: orderer start
    volumes:
      - ../../crypto/faa.uam.nasa.gov/peers/orderer0.faa.uam.nasa.gov/msp:/var/hyperledger/orderer/msp
      - ../../crypto/faa.uam.nasa.gov/peers/orderer0.faa.uam.nasa.gov/tls:/var/hyperledger/orderer/tls
      - ../../crypto/faa.uam.nasa.gov/users:/var/hyperledger/orderer/users
      - ../../crypto/faa.uam.nasa.gov/users/admin0@faa.uam.nasa.gov:/var/hyperledger/orderer/admin
      - ./:/var/hyperledger/config
    ports:
      - 7050:7050
      - 7055:7055
    networks:
      - uam.nasa.gov

I've tried setting GRPC_MAX_RECV_MSG_SIZE to a larger value, as well as upgrading to the newest versions of hyperledger fabric, but it did not seem to work.


Solution

  • Add the below snippet in the orderer.yaml and your issue will be fixed:

    ChannelParticipation:
        Enabled: true
        MaxRequestBodySize: 1 MB