benoitc / couchbeam

Apache CouchDB client in Erlang
Other
242 stars 113 forks source link

cannot interface w/couch after adding administrator #108

Closed iambumblehead closed 7 years ago

iambumblehead commented 10 years ago

Hi Benoit,

I'm unable to add/remove databases or save documents after I added a couch administrator. I'm using couchbeam 1.0.6, erlang 17, couchdb 1.5.

I followed your examples for these functions

dbserverget() ->
    Url = "http://localhost:5984",
    User = "jumpyday",
    Pass = "password",
    Opts = [{basic_auth, {User, Pass}}],
    %%Opts = [],
    couchbeam:server_connection(Url, Opts).

%% {ok, Db}
dbcreate() ->
    Options = [],
    Server = dbserverget(),
    couchbeam:create_db(Server, "userauth", Options).
** exception error: bad argument
     in function  bit_size/1
        called as bit_size("password")
     in call from hackney_request:perform/2 (src/hackney_request.erl, line 39)
     in call from hackney:send_request/2 (src/hackney.erl, line 350)
     in call from couchbeam_httpc:db_request/6 (src/couchbeam_httpc.erl, line 25)
     in call from couchbeam:create_db/4 (src/couchbeam.erl, line 351)

Before adding the administrator I was able to add the document with no credentials, but now if I remove the credentials I see this after calling dbcreate:

dbserverget() ->
    Url = "http://localhost:5984",
    User = "jumpyday",
    Pass = "password",
    %%Opts = [{basic_auth, {User, Pass}}],
    Opts = [],
    couchbeam:server_connection(Url, Opts).
{error,unauthenticated}

Would you tell me what I'm doing wrong?

iambumblehead commented 10 years ago

I solved this by wrapping the user/pass strings with '<<' and '>>'. I would make a commit request to update the documentation. Should I do that?

benoitc commented 10 years ago

yeah it only expect binaries there. I will fix that.

On Wed, Jun 25, 2014 at 8:56 PM, iambumblehead notifications@github.com wrote:

I solved this by wrapping the user/pass strings with '<<' and '>>'. I would make a commit request to update the documentation. Should I do that?

— Reply to this email directly or view it on GitHub https://github.com/benoitc/couchbeam/issues/108#issuecomment-47143371.