pouchdb-server icon indicating copy to clipboard operation
pouchdb-server copied to clipboard

TypeError: Promise.resolve is not a function on pouchdb-auth

Open semiautomatix opened this issue 6 years ago • 0 comments

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.

semiautomatix avatar Jan 24 '19 11:01 semiautomatix