pouchdb / pouchdb-auth

A PouchDB plug-in that simulates CouchDB's authentication daemon. Includes a users db that functions like CouchDB's.
36 stars 11 forks source link

TypeError: Cannot read property 'to' of undefined #44

Open djupvikdigital opened 6 years ago

djupvikdigital commented 6 years ago

Using pouchdb-auth with pouchdb-adapter memory fails for me with the error Security methods already installed. However while digging deeper it turns out that the real error is this:

    TypeError: Cannot read property 'to' of undefined

      at installWrappers (node_modules/pouchdb-wrappers/index.js:48:29)
      at Object.<anonymous>.exports.installWrapperMethods (node_modules/pouchdb-wrappers/index.js:39:3)
      at PouchDB$2.Object.<anonymous>.exports.installSecurityMethods (node_modules/pouchdb-system-db/node_modules/pouchdb-security/index.js:32:12)
      at Object.<anonymous>.exports.installSystemDBProtection (node_modules/pouchdb-system-db/index.js:25:35)
      at node_modules/pouchdb-auth/lib/index.js:67:16

This happens when the function getBaseAndName is called with the name parameter set to "replicate.to". The property replicate is not set on the base object, causing the function to return an object with base set to undefined.

marten-de-vries commented 6 years ago

This repository is about to be deprecated. I think this might be due to an outdated dependency. Probably best to try again after it is merged in the monorepo (+ released): https://github.com/pouchdb/pouchdb-server/pull/274