couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kowsik <kow...@gmail.com>
Subject Re: create_target isn't working with the _replicator db
Date Fri, 22 Jul 2011 14:59:18 GMT
If you have credentials and roles defined on the target DB, you need
to set the the user_ctx in the _replicator doc. Something like this: {
source ..., user_ctx: { roles: [ "admin" ] } }.

K.
---
http://blitz.io
@pcapr

On Fri, Jul 22, 2011 at 4:56 AM, Benoit Chesneau <bchesneau@gmail.com> wrote:
> Hi all,
>
> While testing the _replicator db I encounter an error when trying to
> create the target db . Before opening a ticket I wanted to make sure
> this wasn't expected or if it"s an error.
>
> The error:
>
>    $ curl -XPUT -H"Content-Type: application/json" localhost:5984/a
>    {"ok":true}
>    $ curl -XPUT -d'{}' localhost:5984/a/doca
>    {"ok":true,"id":"doca","rev":"1-967a00dff5e02add41819138abb3284d"}
>     curl -XPUT -d'{}' localhost:5984/a/docb
>    {"ok":true,"id":"docb","rev":"1-967a00dff5e02add41819138abb3284d"}
>    $ curl -XPOST -d'{
>         "source": "a",
>         "target": "b",
>         "create_target": true
>     }' -H"Content-Type: application/json" localhost:5984/_replicator
>    {"ok":true,"id":"2f6df84e4a02978cf80424bce0000f1c","rev":"1-4b8c482da7ce243353493fb87e766428"}
>    enki:~ benoitc$ curl -XGET
> localhost:5984/_replicator/2f6df84e4a02978cf80424bce0000f1c
>    {"_id":"2f6df84e4a02978cf80424bce0000f1c","_rev":"2-b557bd698ecebc359bd5f51b2691a2fd","source":"a","target":"b","create_target":true,"_replication_state":"error","_replication_state_time":"2011-07-22T13:49:21+02:00","_replication_id":"01e205795e3f5ad9968f51e6e1e61335"}
>    enki:~ benoitc$
>
>
>    Error:
>
>                         <<"unauthorized to access database b">>}.
> Retrying in 10 seconds
>    [error] [<0.867.0>] {error_report,<0.30.0>,
>                            {<0.867.0>,crash_report,
>                             [[{initial_call,{couch_rep,init,['Argument__1']}},
>                               {pid,<0.867.0>},
>                               {registered_name,[]},
>                               {error_info,
>                                   {exit,
>                                       {unauthorized,<<"b">>},
>                                       [{gen_server,init_it,6},
>                                        {proc_lib,init_p_do_apply,3}]}},
>                               {ancestors,
>                                   [couch_rep_sup,couch_primary_services,
>                                    couch_server_sup,<0.31.0>]},
>                               {messages,[]},
>                               {links,[<0.81.0>]},
>                               {dictionary,[]},
>                               {trap_exit,true},
>                               {status,running},
>                               {heap_size,610},
>                               {stack_size,24},
>                               {reductions,199}],
>                              []]}}
>
>
> Let me know.
>
> - benoît
>
Mime
View raw message