minifabric icon indicating copy to clipboard operation
minifabric copied to clipboard

Error during adding a new organization

Open ivanvaccarics opened this issue 4 years ago • 12 comments
trafficstars

Dear all, i'm following the docs to add a new organization. I encountered this error:

$ sudo ./minifab approve,discover,commit
Using spec file: /home/security/minifab/spec.yaml
Minifab Execution Context:
    FABRIC_RELEASE=2.3.0
    CHANNEL_NAME=mychannel
    PEER_DATABASE_TYPE=couchdb
    CHAINCODE_LANGUAGE=go
    CHAINCODE_NAME=simple
    CHAINCODE_VERSION=1.0
    CHAINCODE_INIT_REQUIRED=true
    CHAINCODE_PARAMETERS="invoke","a","b","5"
    CHAINCODE_PRIVATE=false
    CHAINCODE_POLICY=
    TRANSIENT_DATA=
    BLOCK_NUMBER=newest
    EXPOSE_ENDPOINTS=7000
    CURRENT_ORG=org0.company.com
    HOST_ADDRESSES=10.0.4.110
    WORKING_DIRECTORY: /home/security/minifab
.......
# Preparing for the following operations: *********************
  verify options, cc approve, discover, cc commit
.......
# Running operation: ******************************************
  verify options
.
# Running operation: ******************************************
  cc approve
......
# Running operation: ******************************************
  discover
........................
# Discover endorsers results **********************************
  Chaincode endorsers file: ./vars/discover/mychannel/simple_endorsers.json
# Discover orderers results ***********************************
  Channel orderers file: ./vars/discover/mychannel/ordererendpoints.json
# Running operation: ******************************************
  cc commit
..........
# Select a random endorser group ******************************
  The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'Layouts'
  
  The error appears to be in '/home/playbooks/common/peerselection.yaml': line 25, column 5, but may
  be elsewhere in the file depending on the exact syntax problem.
  
  The offending line appears to be:
  
  
    - name: Select a random endorser group
      ^ here
  

# STATS *******************************************************
minifab: ok=67	failed=1	

real	0m16.213s
user	0m9.832s
sys	0m2.399s

Could you please help me? Thanks

ivanvaccarics avatar May 03 '21 10:05 ivanvaccarics

@ivanv6 when you do netup or creating new channel, you probably did not do anchorupdate which setup anchor node for discovery to work. If you do anchorupdate, you should be ok. Give it a try and if that is the issue, please close this, otherwise, please detail entire steps so that others can possibly recreate the issue and see what might have gone wrong.

litong01 avatar May 03 '21 12:05 litong01

Any updates on this? If not, please close this.

litong01 avatar May 15 '21 11:05 litong01

Hi, by following the Expand an existing network with a new org tutorial, I've tried with a brand new installation with two nodes (in two separate VMs).

Used specs.yaml files. org0:

fabric:
  cas:
  - "ca1.org0.company.com"
#  - "ca1.org1.example.com"
  peers:
  - "peer1.org0.company.com"
#  - "peer2.org0.example.com"
#  - "peer1.org1.example.com"
#  - "peer2.org1.example.com"
  orderers:
  - "orderer1.company.com"
  - "orderer2.company.com"
  - "orderer3.company.com"
  - "orderer4.company.com"
  settings:
    ca:
      FABRIC_LOGGING_SPEC: DEBUG
    peer:
      FABRIC_LOGGING_SPEC: DEBUG
    orderer:
      FABRIC_LOGGING_SPEC: DEBUG
  ### use go proxy when default go proxy is restricted in some of the regions.
  ### the default goproxy
  # goproxy: "https://proxy.golang.org,direct"
  ### the goproxy in China area
  # goproxy: "https://goproxy.cn,direct"
  ### set the endpoint address to override the automatically detected IP address
  # endpoint_address: 
  ### set the docker network name to override the automatically generated name.
  netname: "mynet"
  ### set the extra optins for docker run command
  # container_options: "--restart=always --log-opt max-size=10m --log-opt max-file=3"

org1:

fabric:
  cas:
#  - "ca1.org0.company.com"
  - "ca1.org1.company.com"
  peers:
#  - "peer1.org0.company.com"
#  - "peer2.org0.example.com"
  - "peer1.org1.company.com"
#  - "peer2.org1.example.com"
#  orderers:
#  - "orderer1.company.com"
#  - "orderer2.company.com"
#  - "orderer3.company.com"
#  - "orderer4.company.com"
  settings:
    ca:
      FABRIC_LOGGING_SPEC: DEBUG
    peer:
      FABRIC_LOGGING_SPEC: DEBUG
    orderer:
      FABRIC_LOGGING_SPEC: DEBUG
  ### use go proxy when default go proxy is restricted in some of the regions.
  ### the default goproxy
  # goproxy: "https://proxy.golang.org,direct"
  ### the goproxy in China area
  # goproxy: "https://goproxy.cn,direct"
  ### set the endpoint address to override the automatically detected IP address
  # endpoint_address: 
  ### set the docker network name to override the automatically generated name.
  netname: "mynet"
  ### set the extra optins for docker run command
  # container_options: "--restart=always --log-opt max-size=10m --log-opt max-file=3"

Here you can find the updated order of commands executed (with initial node).

user@org0: sudo ./minifab up -e 7000 -s couchdb -o org0.company.com
user@org1: sudo ./minifab netup -e 5000 -s couchdb -o org1.company.com
user@org1: scp vars/JoinRequest_org1-company-com.json user@org0:~/minifab/vars/NewOrgJoinRequest.json
user@org0: sudo ./minifab orgjoin
user@org0: scp ~/minifab/vars/profiles/endpoints.yaml user@org1:~/minifab/vars/
user@org1: sudo ./minifab nodeimport,join
user@org0: sudo ./minifab approve,discover,commit

At this point, I get the attached error. Screenshot

alphacybercom avatar Jun 03 '21 09:06 alphacybercom

@ivanv6 after this step, user@org0: sudo ./minifab orgjoin, you probably can run command minifab channelquery to see if the new org is indeed part of the channel.

litong01 avatar Jun 03 '21 13:06 litong01

Thank you @litong01. Just tried but it is not working anyway (added user@org0: sudo ./minifab channel query after orgjoin). The same error is returned, although a new file in vars/mychannel_config.json is generated.

alphacybercom avatar Jun 04 '21 15:06 alphacybercom

@litong01 @alphacybercom

I had almost the same experience before.

When initial setup was 'one peer with one org', as the same as alphacybercom's org0 case, 'add new org' operation was failed by the same error ( 'dict object' has no attribute 'Layouts' in ./vars/discover/mychannel/simple_endorsers.json ).

but when initial setup was ' two peers with two orgs (totally four peers)' as described in docs/ExpandYourNetwork.md 'mysite0/spec.yaml' then 'add new org' operation was succeeded.

so, It seems conditional issue caused by initial number of peers and orgs. it may be touch to debug... orz

itaru2622 avatar Jun 08 '21 10:06 itaru2622

Thank you @itaru2622. Tried with two peers in both the spec.yaml files:

org0's spec.yaml snippet:

peers:
- "peer1.org0.ac.com"
- "peer2.org0.ac.com"

org1's spec.yaml snippet:

peers:
- "peer1.org1.ac.com"
- "peer2.org1.ac.com"

Even in such conditions, the full system is not working.

alphacybercom avatar Jun 15 '21 10:06 alphacybercom

@alphacybercom It maybe good for you to verify if docs/ExpandYourNetwork.md works fine in your environment.

in the doc, first spec.yaml has four peers with two organization as bellow snippet, but your above case org0's spec.yaml has just one organization (two peers in the same org0.ac.com organization.)

In my environment, docs/ExpandYourNetwork.md works fine.

# first spec.yaml in docs/ExpandYourNetwork.md
  peers:
  - "peer1.org0.example.com"
  - "peer2.org0.example.com"
  - "peer1.org1.example.com"
  - "peer2.org1.example.com"

itaru2622 avatar Jun 15 '21 13:06 itaru2622

Thank you @itaru2622. It worked with the following setup.

org0's spec.yaml snippet:

peers:
- "peer1.org0.company.com"
- "peer2.org0.company.com"
- "peer1.org1.company.com"
- "peer2.org1.company.com"

org1's spec.yaml snippet:

peers:
- "peer1.org2.company.com"
- "peer2.org2.company.com"

alphacybercom avatar Jun 17 '21 12:06 alphacybercom

I think I had the same problem. This was happening because the file 'simple_endorsers.json`'was empty for some reason. I recreated it manually just before 'commit' and then, the 'discover' is working normally again. You can create this file based on the content for local network with org0 and org1, just change organization name, IP's, and ports.

donwojtallo avatar Jun 18 '21 15:06 donwojtallo

@alphacybercom I see, that is good. so, your environment can add new org in that case.

In your first case, in which both spec.yaml files had just one peer and the error detected in peerselection.yaml ( in ops/cccommit phase).

I guess that the error was related to former ccapprove phase. in that phase, any endorsement needs to be approved by more than half of the network(peers or orgs) in usual hyperledger fabric usecases.

Its better to have multipe orgs in first spec.yaml and keep thinking "more than half". i.e 2x2 is more than 2+1 but 1x2 is not more than 1+1.

or you may be dropped into endorsement policy hell (dark side of hyperledger fabric :-p)

itaru2622 avatar Jun 18 '21 15:06 itaru2622

@donwojtallo I experienced the same situation before, and got success by manual discover. reason unknown...

itaru2622 avatar Jun 19 '21 01:06 itaru2622