pouchdb-server
pouchdb-server copied to clipboard
TypeError: Promise.resolve is not a function on pouchdb-auth
I'm receiving the following error when using pouchdb-auth:
TypeError: Promise.resolve is not a function
PouchDB../node_modules/pouchdb-auth/lib/index.js.exports.useAsAuthenticationDB
/PWAProjects/pwa-tna/node_modules/pouchdb-auth/lib/index.js:63
60 | }
61 |
62 |
> 63 | return utils.nodify(Promise.resolve().then(function () {
64 | // add wrappers and make system db
65 | if (!info.isOnlineAuthDB) {
66 | wrappers.installWrapperMethods(args.db, writeWrappers);
My code is as below:
import PouchDB from 'pouchdb';
import pouchDBAuth from 'pouchdb-auth';
PouchDB.plugin(pouchDBAuth);
const db = new PouchDB(
'http://localhost:5984/accord-tna',
{
skip_setup: true,
auth: {
username: 'admin',
password: 'password',
}
}
);
db.useAsAuthenticationDB();
As quick check does indeed reveal Promise.resolve to be undefined using the pouchdb-promise import.