Welcome to the Linux Foundation Forum!

error handling CouchDB request. Error:unauthorized, Status Code:401, Reason:You are not a server a

Options

First, Lab3.yaml has an error. There is a space before the USER and PASSWORD values:

couchdbOrg1Peer0:
container_name: couchdbOrg1Peer0
image: hyperledger/fabric-couchdb
environment:
- COUCHDB_USER=​ peer0.Org1
- COUCHDB_PASSWORD=​ password
ports:
- "5984:5984"
networks:
- basic

-------------------------

couchdbOrg1Peer1:
container_name: couchdbOrg1Peer1
image: hyperledger/fabric-couchdb
environment:
- COUCHDB_USER=​ peer1.Org1
- COUCHDB_PASSWORD=​ password
ports:
- "6984:5984"
networks:
- basic

Second, even fixing the extra space causes errors when the peer is starting. This is from the peer0 docker log:
/couchdbOrg1Peer0:5984/: dial tcp 172.21.0.4:5984: connect: connection refused
2019-10-17 01:40:30.794 UTC [couchdb] CreateSystemDatabasesIfNotExist -> ERRO 009 Error calling CouchDB CreateDatabaseIfNotExist() for system dbName: _users, error: error handling CouchDB request. Error:unauthorized, Status Code:401, Reason:You are not a server admin.
2019-10-17 01:40:30.794 UTC [couchdb] VerifyCouchConfig -> ERRO 00a Unable to connect to CouchDB, error: error handling CouchDB request. Error:unauthorized, Status Code:401, Reason:You are not a server admin.. Check the admin username and password.

This is causing my peer container to die when I try to add it to the channel.

The only way to get the peer to communicate with the CouchDB is to start CouchDB in Admin Party mode by not providing values for the COUCHDB_USER=​ , COUCHDB_PASSWORD=​ variables. But I am sure this is a security issue.

Why can't I specify COUCHDB_USER=​peer1.Org, COUCHDB_PASSWORD=​password?

Comments

  • fourtic
    Options

    Hi,

    the error comes from copying an invalid character from the pdf on COUCHDB_USER and COUCHDB_PASSWORD variables (not only before value, at the end too). I have deleted these variables and have written them again and now its all ok. I try to set values on these variables and empty values too, and both cases it has worked.

  • BrettR
    BrettR Posts: 10
    Options

    Copying code from the PDF will cause endless problems. Characters on a PDF may not always be what they appear to be. Text on a PDF is drawn (glyph) and mapped back to a character that is stored in the PDF file. That mapping is not always efficient. My experience so far is to use best practice when learning and to type the code out. Good luck.

Categories

Upcoming Training