firebase 队列初始化失败

firebase-queue initialization failing

我的 Firebase 队列初始化失败并出现以下错误。我正在使用 Firebase 3。

Task was malformed

堆栈跟踪

"Error: Task was malformed\n    at Object.update
(/Users/kanishkanagaraj/JeetLab/BetMe/firebase-queue/node_modules/firebase-queue/dist/lib/queue_worker.js:446:27)\n
at ei
(/Users/kanishkanagaraj/JeetLab/BetMe/firebase-queue/node_modules/firebase/database-node.js:217:395)\n
at U.h.transaction
(/Users/kanishkanagaraj/JeetLab/BetMe/firebase-queue/node_modules/firebase/database-node.js:232:466)\n
at
/Users/kanishkanagaraj/JeetLab/BetMe/firebase-queue/node_modules/firebase-queue/dist/lib/queue_worker.js:439:30\n
at c
(/Users/kanishkanagaraj/JeetLab/BetMe/firebase-queue/node_modules/firebase/database-node.js:153:58)\n
at
/Users/kanishkanagaraj/JeetLab/BetMe/firebase-queue/node_modules/firebase/database-node.js:144:614\n
at Qb
(/Users/kanishkanagaraj/JeetLab/BetMe/firebase-queue/node_modules/firebase/database-node.js:43:165)\n
at sc
(/Users/kanishkanagaraj/JeetLab/BetMe/firebase-queue/node_modules/firebase/database-node.js:31:216)\n
at rc
(/Users/kanishkanagaraj/JeetLab/BetMe/firebase-queue/node_modules/firebase/database-node.js:30:1104)\n
at yg
(/Users/kanishkanagaraj/JeetLab/BetMe/firebase-queue/node_modules/firebase/database-node.js:215:313)"

我的代码:

var ref = firebase.database().ref('queue');
    var queue = new Queue(ref, function(data, progress, resolve, reject) {

      console.log(data);


       // Do some work
      progress(50);

      // Finish the task asynchronously
      setTimeout(function() {
        resolve();
      }, 1000);

那是因为你试图添加一个只有字符串的任务,你需要添加一个对象,它应该是这样的:

{
  "queue": {
    "tasks": {
      "someKey": {
        "foo": true
      }
    }
  }
}