Angular IBM Cloudant/PockDB复制问题,状态:400,请求错误

Angular IBM Cloudant/PockDB复制问题,状态:400,请求错误,angular,typescript,replication,pouchdb,cloudant,Angular,Typescript,Replication,Pouchdb,Cloudant,远程IBM Cloudant数据库复制出现错误。 我正在使用带有TypeScript的Angular 8应用程序中的“PockDB”:“^7.2.1”。 最奇怪的是,它有时有效,有时无效。 如果不是,它会说: CustomPouchError {error: "bad_request", reason: "Please supply either IAM session cookie or basic auth not both", status: 400, name: "bad_request

远程IBM Cloudant数据库复制出现错误。 我正在使用带有TypeScript的Angular 8应用程序中的“PockDB”:“^7.2.1”。 最奇怪的是,它有时有效,有时无效。 如果不是,它会说:

CustomPouchError {error: "bad_request", reason: "Please supply either IAM session cookie or basic auth not both", status: 400, name: "bad_request", message: "Please supply either IAM session cookie or basic auth not both", …}
error: "bad_request"
reason: "Please supply either IAM session cookie or basic auth not both"
status: 400
name: "bad_request"
...
用于从远程数据库复制的代码是直截了当的:

private startReplication(localDB: PouchDB.Database, remoteDB: PouchDB.Database):Promise<PouchDB.Database> {
    return new Promise((resolve, reject) => {
      let replicationHandler = localDB.replicate
        .from(remoteDB, {
          batch_size: 200,
          batches_limit: 10
        })
        .on("paused", info => {
          replicationHandler.cancel()
        })
        .on("complete", info => {
          replicationHandler.cancel()
          resolve()
        })
        .on("error", err => {
          replicationHandler.cancel()
          reject(err)
        })
    })
  }

Cloudant服务器似乎认为您正在使用基本身份验证和IAM会话cookie发出请求,但遭到拒绝。也许可以尝试清除您的Cloudant cookie?

Cloudant服务器似乎认为您正在使用基本身份验证和IAM会话cookie发出请求,但遭到拒绝。也许试着清理一下你的Cloudant饼干

let userDB = "https://token:password@myurl.cloudant.com/mydatabase$username"
this.remoteDB = new PouchDB(`${userDB}`, {
      auto_compaction: true
    })