colinskow / superlogin

Powerful authentication for APIs and single page apps using the CouchDB ecosystem which supports a variety of providers.
MIT License
370 stars 116 forks source link

TypeError: Cannot read property 'valid' of undefined at Function.PouchDB.parseAdapter #207

Open matthiasunt opened 5 years ago

matthiasunt commented 5 years ago

I'm recieving the following error (Superlogin version 0.6.1):

(node:1705) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'valid' of undefined
    at Function.PouchDB.parseAdapter (/Users/matthias/Dev/Git/sf-nest-server/node_modules/superlogin/node_modules/pouchdb/lib/index.js:2447:36)
    at /Users/matthias/Dev/Git/sf-nest-server/node_modules/superlogin/node_modules/pouchdb/lib/index.js:2328:27
    at /Users/matthias/Dev/Git/sf-nest-server/node_modules/superlogin/node_modules/pouchdb/lib/index.js:2356:6
    at new Promise (<anonymous>)
    at new PouchDB (/Users/matthias/Dev/Git/sf-nest-server/node_modules/superlogin/node_modules/pouchdb/lib/index.js:2306:17)
    at new module.exports (/Users/matthias/Dev/Git/sf-nest-server/node_modules/superlogin/lib/index.js:36:14)
    at /Users/matthias/Dev/Git/sf-nest-server/src/main.ts:13:27
    at Generator.next (<anonymous>)
    at fulfilled (/Users/matthias/Dev/Git/sf-nest-server/src/main.ts:4:58)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)
    at Function.Module.runMain (module.js:695:11)
    at Object.<anonymous> (/Users/matthias/Dev/Git/sf-nest-server/node_modules/ts-node/src/bin.ts:157:12)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3
(node:1705) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 5)
(node:1705) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code

My config.js

const path = require('path');

module.exports = {
  dbServer: {
    protocol: process.env.DB_PROTOCOL + '://',
    host: process.env.DB_HOST,
    user: process.env.DB_USER,
    password: process.env.DB_PASS,
    cloudant: false,
    userDB: 'dev-sf-users',
    couchAuthDB: '_users',
  },
  security: {
    defaultRoles: ['user'],
    maxFailedLogins: 3,
    lockoutTime: 600,
    tokenLife: 86400,
    loginOnRegistration: true,
  },
  local: {
    sendConfirmEmail: false,
    requireEmailConfirm: false,
    emailUsername: false,
  },
  userDBs: {
    model: {
      sf: {
        // designDocs: ['blacklist', 'calls', 'favorites', 'ratings'],
        permissions: ['_reader', '_writer', '_replicator'],
      },
    },
    defaultDBs: {
      private: ['dev-sf'],
    },
    designDocDir: path.join(__dirname, './ddocs-users'),
  },
  userModel: {
    whitelist: [],
    validate: {},

  },
};