Closed
Description
When a user authenticates with a CouchDB session
await db.auth('myuser', 'mypassword')
The cookie is stored and everything works... until the cookie expires. The cookie handler (a third-party library) doesn't refresh CouchDB's repeated attempts to refresh the cookie. So after an hour (by default), the session expires and the user is forced to reauthenticate.
This may be a bug that the Cloudant folks spotted in tough-cookie: salesforce/tough-cookie#154
Expected Behavior
If I establish a valid session, and I make nano requests within the cookie expiry window and CouchDB sends a new cookie, the new cookie should be used from that point on.
Current Behavior
Today, only the first cookie is saved and the user's session expires with it.
Steps to Reproduce (for bugs)
const Nano = require('.')
const nano = Nano(process.env.COUCH_URL)
const sleep = async (ms) => {
return new Promise((resolve, reject) => {
setTimeout(resolve, ms)
})
}
const main = async () => {
await nano.auth(process.env.COUCH_USER, process.env.COUCH_PASSWORD)
do {
const r = await nano.db.list()
console.log(new Date().toISOString(), r.length)
await sleep(30000)
} while (1)
}
main()
Wait for an hour.
Your Environment
- Nano 10.1.1, Node 16, Mac M1