Chi.che
Chi.che

Reputation: 33

fabric-ca-client enroll with error Failed to read response of request: POST http://localhost:7054

I checkout project fabric-samples and run file startFabric.sh to start Fabric blockchain network.
After that, I run node enrollAdmin.js to enroll the new admin
Now, I want to use the command line of fabric-ca-client to add a new user to org1. I execute the commands below:

  1. Access to ca_peerOrg1 docker
    docker exec -it ca_peerOrg1 bash

  2. I check the value of
    $FABRIC_CA_CLIENT_HOME is unset
    $FABRIC_CA_HOME is /etc/hyperledger/fabric-ca-server

  3. Go to /etc/hyperledger/fabric-ca-server directory and check command
    fabric-ca-client

    enter image description here
  4. And run this command fabric-ca-client enroll -u http://admin:adminpw@localhost:7054
    But it occurs error below:

enter image description here

Anyone could help? Thanks for reading

Upvotes: 1

Views: 1498

Answers (1)

yilin
yilin

Reputation: 31

I just encountered the same problem. For anyone who is interested, this error indicates fabric-ca-server is running with TLS enabled.

To get rid of this error, you need to make the following changes to the fabric-ca-client command:

  • use https instead of http in the url
  • use ca host name instead of localhost in the url
  • provide the TLS cert file for the server's listening port via --tls.certfile

e.g. fabric-ca-client enroll -u https://admin:[email protected]:7054 --tls.certfiles /certs/ca/ca.org0.example.com-cert.pem

The TLS cert file was generated by fabric-ca-server at startup. The default file location is $FABRIC_CA_SERVER_HOME/tls-cert.pem. Otherwise, the location is specified by $FABRIC_CA_SERVER_TLS_CERTFILE or fabric-ca-server-config.yaml

Upvotes: 3

Related Questions