Skip to content

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

@semiautomatix

Description

@semiautomatix

Issue

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);

Info

  • Environment: React.js
  • Platform: Chrome
  • Adapter: n/a
  • Server: CouchDB

Reproduce

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions