Search code examples
couchdbnodejitsuhoodie

hoodie app on nodejitsu: added %2f confounding couchdb request


I have deployed a basic tutorial hoodie app on nodejitsu (which works fine on my local server). Here is the url of my deployed app:

http://reggie.nodejitsu.com

A signup button is supposed to appear in the upper right hand corner after user login status is confirmed, which it does, but after a very, very long time.

Looking at the log file on nodejitsu, I see (personal detail redacted):

Streaming logging information

out Thu, 13 Nov 2014 18:51:25 GMT Starting Plugin: 'hoodie-plugin-users'
out Thu, 13 Nov 2014 18:51:25 GMT All plugins started.
err Thu, 13 Nov 2014 18:51:25 GMT { [Error: not_found
missing]

and then a little later:

_header: 'GET /_users/org.couchdb.user%3Aadmin%2F HTTP/1.1\r\nHost: xxxxxxxxx.iriscouch.com\r\nAccept: application/json\r\nAuthorization: Basic YWRtaW46bm9uY3JpdGljYWw=\r\nConnection: keep-alive\r\n\r\n',

and then a little later:

out Thu, 13 Nov 2014 18:51:25 GMT 
err Thu, 13 Nov 2014 18:51:25 GMT Error confirming user: Error: not_found
missing

If I request the endpoint /_users/org.couchdb.user%3Aadmin%2F from my nodejitsu couchdb instance directly, that fails with {"error":"not_found","reason":"missing"}. But if I remove the trailing encoded slash, /_users/org.couchdb.user%3Aadmin, I get the user returned as expected.

So it seems to me the trailing encoded slash (%2f) is messing up the authentication with couchdb, and then I presume the very long delay the app takes to figure out if the user is logged in to the app is resulting from a timeout trying access the database without the required credentials. But I do not know how to stop the trailing encoded slash from being added.

Have I diagnosed the issue correctly, and either way, how can I resolve this issue?

Thanks!


Solution

  • it looks like you have a user document for the CouchDB user "admin" in your _users database, which should not exist. CouchDB admin users don't have own documents in the _users database. The Hoodie error you get is because of the wrong format of the _users object and the missing user database. When you remove /_users/org.couchdb.user%3Aadmin%2F it should work as expected.