juanp123 commented on issue #183: nano.use is not a function... Readme.md not 
up-to-date? 
URL: https://github.com/apache/couchdb-nano/issues/183#issuecomment-580808480
 
 
   Ran into the above problem and it is repeatable..
   
   Using the initial example for reference: 
   ```
   const nano = 
require("nano")(`http://${couchdb.username}:${couchdb.password}@${couchdb.host}`);
   
   const db = nano.use(`${couchdb.userDB}`)
   ```
   The missing `.use(...)` is caused by an invalid URL.  
   
   in ` module.exports = exports = function dbScope (cfg)`
   the return is as follows (last two lines)
   ```
     const db = maybeExtractDatabaseComponent()
   
     return db ? docModule(db) : serverScope
   
   ```
   Haven't dug into the details of these last lines but can say that if the url 
is invalid, it appears it will not return the serverScope which contains the 
`use(...)` 
   
    In my case `process.env.SOMEVAR` was being used to set the url but was 
wasn't configured properly so the url was getting null or undefined values.  
Once that was fixed, `.use(...)` exists.
   
   Just leaving this as a reference for others with that have the same issue. 
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to