当同步到cognito时,cognito同步管理器会出错

时间:2017-10-05 04:58:07

标签: javascript amazon-web-services amazon-cognito

我想使用cognito同步管理器同步一些关于cognito的数据。

这是我的工具代码。

synchronize () {
    let template = this
    return new Promise(function (resolve, reject) {
      template.dataset.synchronize({
      onSuccess: function (dataset, newRecords) {
          resolve(newRecords)
        },
      onFailure: function (err) {
          reject(err)
        },
      })
}

我写了一个像这样的测试

it('should synchronize success when #synchronize()', function () {
    this.timeout(15000)
    let cognitoSync = new CognitoSync(credentials, userAttributes.name)
    return cognitoSync.init(credentials, userAttributes.name)
    .then(function () {
      return cognitoSync.put('key123', 'value123')
    }).then(function (record) {
      return cognitoSync.synchronize()
    }).then(function (result) {
      console.log(result)
    }).catch(function (err) {
      assert.fail(err)
    })
  })

我记录了newRecord。但是阵列中没有任何东西

假设我的凭证是正确的(我写了另一个测试来测试它)

我想知道我做错了什么?

非常感谢!

0 个答案:

没有答案