Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When trying to issue an identity, it says my CA does not exist

I'm trying to issue an identity by

composer identity issue -p hlfv1 -n bonusetis -i PeerAdmin -s password -u perelluis -x true -a perelluis

But I get

Error: fabric-ca request register failed with errors [[{"code":0,"message":"CA 'ca_peerOrg1' does not exist"}]]
Command failed.

Command succeeded

And I do have a CA named ca_peerOrg1, as I have used it so far and it shows up in my docker containers:

CONTAINER ID        IMAGE                                        COMMAND                  CREATED             STATUS              PORTS                                              NAMES
425df4a2d729        hyperledger/composer-playground              "pm2-docker compos..."   30 minutes ago      Up 30 minutes       0.0.0.0:8080->8080/tcp                             composer-playground
5d6ac09d2f41        dev-peer0.org1.example.com-bonusetis-0.9.0   "chaincode -peer.a..."   2 hours ago         Up 2 hours                                                             dev-peer0.org1.example.com-bonusetis-0.9.0
b115a06eebdb        dev-peer1.org1.example.com-bonusetis-0.9.0   "chaincode -peer.a..."   2 hours ago         Up 2 hours                                                             dev-peer1.org1.example.com-bonusetis-0.9.0
bd2b4a5dfced        hyperledger/fabric-tools                     "/bin/bash"              3 hours ago         Up 3 hours                                                             cli
76a1159e510c        hyperledger/fabric-ca                        "sh -c 'fabric-ca-..."   3 hours ago         Up 3 hours          0.0.0.0:8054->7054/tcp                             ca_peerOrg2
92c6786f3ff1        hyperledger/fabric-peer                      "peer node start"        3 hours ago         Up 3 hours          0.0.0.0:10051->7051/tcp, 0.0.0.0:10053->7053/tcp   peer1.org2.example.com
f439f9f809c6        hyperledger/fabric-orderer                   "orderer"                3 hours ago         Up 3 hours          0.0.0.0:7050->7050/tcp                             orderer.example.com
8584208cd8a8        hyperledger/fabric-peer                      "peer node start"        3 hours ago         Up 3 hours          0.0.0.0:9051->7051/tcp, 0.0.0.0:9053->7053/tcp     peer0.org2.example.com
7e68ac2e33b4        hyperledger/fabric-peer                      "peer node start"        3 hours ago         Up 3 hours          0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp     peer0.org1.example.com
8688c0ef16da        hyperledger/fabric-ca                        "sh -c 'fabric-ca-..."   3 hours ago         Up 3 hours          0.0.0.0:7054->7054/tcp                             ca_peerOrg1
baa42aa6bb12        hyperledger/fabric-peer                      "peer node start"        3 hours ago         Up 3 hours          0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp     peer1.org1.example.com

My connection profile shows the same name for the CA, with the correct ports.

If it's of any help, if I try to access the ports of the peers I get a

This page isn’t working

0.0.0.0 sent an invalid response.

message, but if I try to access the localhost:7054, I get a 404 page not found. I think this is expected, but just in case it tells something.

As seen in the containers, I'm using latest versions of Fabric(beta) and Composer(0.9) and I'm on Ubuntu 16.04 TLS.

like image 456
Pere-Lluis Huguet Avatar asked Jul 04 '17 11:07

Pere-Lluis Huguet


3 Answers

Problem was the name of the CA on the Connection Profile must be the name of the server, as a global defined by
- FABRIC_CA_SERVER_CA_NAME= $CA_NAME So the $CA_NAME must be set in your Connection Profile, and not the containers name. Hope it helps if someone is facing the same problem

like image 200
Pere-Lluis Huguet Avatar answered Nov 14 '22 18:11

Pere-Lluis Huguet


For anyone else who gets this error when using docker, ensure this flag is set for the CA container FABRIC_CA_SERVER_CA_NAME=myca-name in your docker-compose.yml file

like image 22
antoniovassell Avatar answered Nov 14 '22 18:11

antoniovassell


Adding a few details to Pere-Lluis answer.

fabric ca name in network-config must be equal to ca container's FABRIC_CA_SERVER_CA_NAME=ca-org1


CA service

services:
  ca.org1.example.com:
    image: hyperledger/fabric-ca
    environment:
      - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
      - FABRIC_CA_SERVER_CA_NAME=ca-org1
      - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem
      - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/a7d47efa46a6ba07730c850fe93c5b8ef6f4c1c91d9e6e577c33163609fe40011_sk
      - FABRIC_CA_SERVER_TLS_ENABLED=true
      - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem
      - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/a7d47efa46a6ba07730c850fe93c5b8ef6f4c1c91d9e6e577c33163609fe40011_sk
    ports:
      - "7054:7054"
    command: sh -c 'fabric-ca-server start -b admin:adminpw -d'
    volumes:
      - ./channel/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
    container_name: ca_peerOrg1

CA name is ca-org1 -- - FABRIC_CA_SERVER_CA_NAME=ca-org1

network-config.yaml

certificateAuthorities:
  ca-org1:
    url: "http://localhost:7054"
    httpOptions:
      verify: false
    tlsCACerts:
      path: "artifacts/channel/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem"
    registrar:
      - enrollId: "admin"
        enrollSecret: "adminpw"
    caName: ca-org1

caName must be the name which is set to this environment variable FABRIC_CA_SERVER_CA_NAME. In this case, it is ca-org1.

Anything other than this will give ca not exist error for this service.

like image 1
Shubham Chadokar Avatar answered Nov 14 '22 17:11

Shubham Chadokar