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

Tests Failing #24

Open Shard opened 8 years ago

Shard commented 8 years ago

I started to look into #23 as It recently stopped working for me, after running the tests locally I get a few errors: https://gist.github.com/Shard/ebefea0bbd1a089faddb8c8d336c9eef

I started to look into the eval being called in /node_modules/couch_eval/ and it was trying to pass through this: https://gist.github.com/Shard/b0f9c002fdc73e5f01880cfb380a8a00

Not 100% sure where to go from here in terms of what should be happening here.

I'm running on Node 6.8 on Elemtentry OS

Shard commented 8 years ago

I spent some more time debugging through my app this time and the error I ended up getting even when rolling back pouch-auth to when the build was passing was:

TypeError: db.getUrl is not a function
    at /home/mark/git/worker/node_modules/pouchdb-req-http-query/index.js:75:18
    at httpQuery (/home/mark/git/worker/node_modules/pouchdb-req-http-query/index.js:31:10)
    at PouchDB.exports.logIn (/home/mark/git/worker/node_modules/pouchdb-auth/lib/sessionapi.js:51:15)
    at DB.Remote.useAsAuthenticationDB.then (/home/mark/git/worker/src/db.js:21:15)
    at process._tickDomainCallback (internal/process/next_tick.js:129:7)
    at Module.runMain (module.js:606:11)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

I rolled back pouchdb to version 5 from 6 and it seems be behaving now.

nolanlawson commented 8 years ago

This was a private API removed in v6: https://pouchdb.com/2016/09/05/pouchdb-6.0.0.html

You will have to use db.name instead.

Shard commented 8 years ago

Ah ok, the only thing is I believe the call is coming from pouch-req-http-query itself as I haven't got that call in my codebase. I will probably have another look at this later tonight to see i can track it down further.

rogsfernandes commented 7 years ago

I have the same problem. Had to downgrade my pouch to 5 to get things working.

marten-de-vries commented 7 years ago

Sorry, no time to fix it currently, but if someone else wants to this is where getUrl() (which is indeed now deprecated) is called: https://github.com/pouchdb/pouchdb-req-http-query/blob/master/index.js#L75

Seems like there isn't really a good alternative to getUrl() other than asking the user to (again) specify the host and manually constructing the URL, sadly. That means that a fix would also need to change modules dependent on this one (like pouchdb-auth), to pass that value along everywhere. It's not really user-friendly, but the only fix without patching PouchDB.

If db.name includes the URL (which https://github.com/pouchdb/pouchdb/pull/5435 suggests), it should be a pretty easy fix.

ghost commented 7 years ago

Hi there,

is there a fix out by now?