You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is often a good practice to always setup an admin of a database, i.e. at db creation, c.f. #239.
Unfortunately, the following crashes the first time the server is launches (even if one doesn't wait for the callback):
// Create the app.constapp=express();constexpressPouchDB=ExpressPouchDB(PouchDB);// Set up the admin.awaitnewPromise((resolve,reject)=>{expressPouchDB.couchConfig.set('admins',config.adminName,config.adminPassword,err=>{if(err)reject(err);elseresolve()})});// Go.app.use(expressPouchDB);app.listen(config.port);
with:
TypeError: refreshUsersDBImpl is not a function
at CouchConfig.refreshUsersDB (/Users/qroy/Workspace/Code/project/node_modules/express-pouchdb/lib/routes/authentication.js:74:12)
at CouchConfig.emit (events.js:182:13)
at /Users/qroy/Workspace/Code/project/node_modules/express-pouchdb/lib/config-infrastructure.js:136:10
at FSReqWrap.oncomplete (fs.js:145:20)
Subsequent launches would work however. It seems the issue is due to the _users database not being ready yet when the admin is set. Unfortunately, some process still try to update it without waiting.
A somewhat ridiculous workaround is to do this:
// Create the app.constapp=express();constexpressPouchDB=ExpressPouchDB(PouchDB);// Wait for the _users database to be ready 😔// (I've tried `await DB('_users').info()` instead without success).awaitDB('_users').get('whatever').catch(()=>{});// Set up the admin.awaitnewPromise((resolve,reject)=>{expressPouchDB.couchConfig.set('admins',config.adminName,config.adminPassword,err=>{if(err)reject(err);elseresolve()})});// Go.app.use(expressPouchDB);app.listen(config.port);
The text was updated successfully, but these errors were encountered:
It is often a good practice to always setup an admin of a database, i.e. at db creation, c.f. #239.
Unfortunately, the following crashes the first time the server is launches (even if one doesn't wait for the callback):
with:
Subsequent launches would work however. It seems the issue is due to the
_users
database not being ready yet when the admin is set. Unfortunately, some process still try to update it without waiting.A somewhat ridiculous workaround is to do this:
The text was updated successfully, but these errors were encountered: