You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2023/01/17 23:00:59 UTC

[GitHub] [couchdb-nano] jkeczan opened a new issue, #322: Replication Enable creating correct document

jkeczan opened a new issue, #322:
URL: https://github.com/apache/couchdb-nano/issues/322

   We are having issues with creating replications using ```replication.enable```. The server accepts the request but the replication document does not contain the correct replication information therefore it doesn't start
   
   ## Expected Behavior
   When we call ```replication.enable(source, target, {create_target: false})```, we expect the source of the replication document to look like the following:
   
   ```
   {
     "_id": "9d2ad6fedf2c919a28463cef8800086c",
     "_rev": "1-1a6c06225aca25efad513b58ee0866bd",
     "user_ctx": {
       "name": "admin",
       "roles": [
         "_admin",
         "_reader",
         "_writer"
       ]
     },
     "source": {
       "url": "https://test.url.com:5984/soloDB-5-63",
       "headers": {
         "Authorization": "Basic JIMBOB=="
       }
     },
     "target": {
       "url": "mainDB",
       "headers": {
         "Authorization": "Basic JOHNSMITH=="
       }
     },
     "create_target": false,
     "continuous": true,
     "owner": "admin"
   }
   ```
   
   ## Current Behavior
   However, we are currently getting this document instead with the replication failing to launch and the UI showing it does NOT see any credentials.
   
   ```
   {
     "_id": "7131260c0b1a10fddb66464ce802eb2d",
     "_rev": "1-7d100014ab0dc2b18548e06d63f17940",
     "continuous": true,
     "create_target": false,
     "source": "https://user:pass@test.url.com:5984/soloDB-5-27",
     "target": "mainDB",
     "owner": "admin"
   }
   ```
   
   ## Possible Solution
   At this point, I do not have a possible solution other than potentially dropping down to make a custom request. However, I feel like I am doing something incorrect here and wanted to reach out first.
   
   ## Steps to Reproduce (for bugs)
   ```
   const url = 'test.url.com';
    const sourceURL = `https://user:pass@${url}/soloDB-5-27`;
           const targetURL = `mainDB`;
   
   return database.db.replication.enable(sourceURL, targetURL, {
             continuous: true,
             create_target: false,
           });
   ```
   
   ## Context
   Right now, this is preventing me from writing an automated onboarding tool that creates the database for a user when they are added to our HR databases.
   
   ## Your Environment
   <!--- Include as many relevant details about the environment you experienced the bug in -->
   * Version used: 10.1.0
   * Browser Name and version:
   * Operating System and version (desktop or mobile): ECS w/latest Docker Image
   * Link to your project: N/A
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [couchdb-nano] glynnbird commented on issue #322: Replication Enable creating incorrect document

Posted by GitBox <gi...@apache.org>.
glynnbird commented on issue #322:
URL: https://github.com/apache/couchdb-nano/issues/322#issuecomment-1386719578

   Thanks for the reports @jkeczan but I don't think "replication.enable" is doing anything unexpected here. As you can see from the [code](https://github.com/apache/couchdb-nano/blob/main/lib/nano.js#L586-L598), its job is to create a document in the `_replicator` database  with a source and target in it. 
   
   If I were you I would just write the document yourself and you get complete control:
   
   e.g.
   
   ```js
   const replicator = nano.db.use('_replicator')
   const doc = {
     source: 'https://mysourceurl.com/a',
     target: 'https://myothersourceurl.com/b',
     create_target: true
   }
   await replicator.insert(doc)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [couchdb-nano] jkeczan commented on issue #322: Replication Enable creating incorrect document

Posted by GitBox <gi...@apache.org>.
jkeczan commented on issue #322:
URL: https://github.com/apache/couchdb-nano/issues/322#issuecomment-1387315923

   I had already figured that one out as a workaround after I posted the issue but thought it was odd that the replicate function didn't create a document that could be replicated. Appreciate the feedback.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [couchdb-nano] glynnbird closed issue #322: Replication Enable creating incorrect document

Posted by GitBox <gi...@apache.org>.
glynnbird closed issue #322: Replication Enable creating incorrect document
URL: https://github.com/apache/couchdb-nano/issues/322


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org