【问题标题】:PouchDB bi-directional sync with Cloudant failurePouchDB 双向同步 Cloudant 失败
【发布时间】:2015-02-16 23:59:40
【问题描述】:

我正在尝试将本地用户数据存储 (PouchDB) 同步回 Cloudant,但是在 chrome 中我收到三个错误:

第一个错误

请求: https://username.cloudant.com/?_nonce=Hz8xwDku9d4vvorf 回复: {"error":"not_found","re​​ason":"数据库不存在。"}

第二个错误

请求: https://username.cloudant.com/?_nonce=ml2mu2jJjMUnKpnw 回复 {"error":"not_found","re​​ason":"数据库不存在。"}

第三个错误

请求: https://username.cloudant.com/remote_db/_local/48Y4.efvo8bosN3v5QMY3A==?_nonce=SM5SwURV6nLHA5f2 响应L {"error":"not_found","re​​ason":"missing"}

使用最新版本的 PouchDB 3.2.1 版

var db = new PouchDB(dbname, {adapter : 'websql'});

        var options = {
            live: true, 
            filter: 'userdb/by_profileId', 
            query_params: { "PROFILEID": dbname}, 
            include_docs: {conflicts: true, attachments: true}
    };

        db.replicate.from(source, options);
        db.replicate.to(source, options);

我不确定为什么第一个和第二个引用不存在的数据库。我能够对本地数据存储进行更改而不会出现任何错误,我只是无法同步到远程数据存储(Cloudant)。有什么想法吗?

【问题讨论】:

    标签: pouchdb


    【解决方案1】:

    也许您没有包含您的 Cloudant 用户名/密码?或者 Cloudant 不允许 PouchDB 代表您创建新数据库?检查网络面板,看看 PouchDB 是否尝试 PUT 一个新数据库,以及 Cloudant 的回应。

    【讨论】:

    • 是的,我在 url 中包含了用户名和密码。
    【解决方案2】:

    我不确定发生了什么,但自从升级到 PouchDB 3.3.0 版后,问题不再出现。

    【讨论】:

      猜你喜欢
      • 2016-03-29
      • 1970-01-01
      • 2016-12-08
      • 2019-10-14
      • 2014-10-27
      • 1970-01-01
      • 2014-12-23
      • 2018-10-28
      • 1970-01-01
      相关资源
      最近更新 更多