apache / couchdb-fauxton

Fauxton is the new Web UI for CouchDB

Home Page:https://github.com/apache/couchdb-fauxton

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

replication_auth_error while adding a Fauxton replication

razcakappa opened this issue · comments

Description

From fauxton, when adding a replication request for simply replicate two local dbs, it fails. Couchdb server dumps following

[error] 2020-02-24T13:02:38.833469Z nonode@nohost <0.25331.2> -------- throw:{replication_auth_error,{session_request_failed,"http://localhost:5960/_session","root",{conn_failed,{error,econnrefused}}}}: Replication b74453cfeaebef74832d4b6e3458c4eb+create_target failed to start "http://localhost:5960/adsman/" -> "http://localhost:5960/adsman2/" doc <<"shards/80000000-9fffffff/_replicator.1582536482">>:<<"9524c7d42d681a16e48cedd5c9004cba">> stack:[{couch_replicator_httpc,setup,1,[{file,"src/couch_replicator_httpc.erl"},{line,63}]},{couch_replicator_api_wrap,db_open,4,[{file,"src/couch_replicator_api_wrap.erl"},{line,74}]}]

Steps to Reproduce

  1. Run a new couchdb docker instance with correct port mapping to host machin.
  2. Open up Fauxton and create an admin user.
  3. With same user add a DB with sample document.
  4. With the same user add a replication from Fauxton screen to replicate the above DB to new DB
  5. Submit the request and subscribe to Couchdb server log to see the error

Expected Behaviour

Two DBs should be properly replicated.

Your Environment

Docker-compose environment with following yaml.

couchdb:
  container_name: test_couchdb
    image: couchdb:latest
    ports:
      - "5960:5984"
    volumes:
      - adsman_data:/opt/couchdb/data
      - adsman_lib:/var/lib/couchdb
  • v 2.31
  • Firefox 73.0.1 (64-bit) on ubuntu
  • Couchdb runs on docker debian

Additional Context

@razcakappa it looks like the container is trying to connect to the container's 5960 port on localhost. Make sure that it can can reach that port and connect to it.

@nickva Thanks for pointing out my silly mistake. I just edited the raw replication document and added localhost:5984 and it started to work.

However I assume on Fauxton, it still gets the browser's port when recording replication data about local DBs. Isn't this supposed to be a bug or am I missing something again as usual?

Glad it worked.

And agree it does seem like a bug. I don't know much about how Fauxton builds the local UR. It might grab whatever it sees from the browser's location perhaps? But I can see in general how running from a container with port forwarding there might not even be a way to determine a proper "local" version for the endpoints.

I just checked the Fauxton code and it simply grabs the URL from the window object it seems.

Helpers.getRootUrl = ({origin, pathname} = window.location) => {
  return url.resolve(origin + pathname, app.host);
};

If CouchDB provides a way to get server URL with ports then this can be fixed from the Fauxton end.