错误:需要使用事件参数调用云函数。 Firebase控制台错误,

时间:2019-04-29 12:21:14

标签: javascript firebase google-cloud-firestore google-cloud-functions

我已经将Firebase节点版本从6升级到了8,还将firebase功能,打字稿版本以及firebase-admin升级了。 但是我在几个触发器上遇到了这个错误。

  

错误:需要使用事件参数调用Cloud函数。如果>要编写单元测试,请使用Node模块firebase-?> functions-fake。      在对象。 (/srv/node_modules/firebase->functions/lib/cloud-functions.js:84:19)

exports.userFollowingChanged = functions.firestore
  .document("Db1/{domainName}/Users/{byUser}/toIds/{toId}")
  .onWrite((change, context) => {
    return wasTriggered(context.eventId, 'userFollowingChanged').then(() => {
      return userFollowingChanged(change, context)
    });
  });

我的package.json如下

{
  "name": "functions",
  "scripts": {
    "lint": "tslint --project tsconfig.json",
    "build": "tsc --skipLibCheck",
    "serve": "npm run build && firebase serve --only functions",
    "shell": "npm run build && firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "main": "lib/index.js",
  "dependencies": {
    "@firebase/database": "0.1.9",
    "cors": "^2.8.4",
    "elasticsearch": "^15.1.1",
    "firebase-admin": "~5.13.0",
    "firebase-functions": "^2.0.0",
    "moment": "^2.20.1",
    "nodemailer": "^4.6.0",
    "request": "^2.83.0",
    "request-promise": "^4.2.2",
    "stripe": "^5.5.0",
    "twilio": "^3.12.0",
    "twitter": "^1.7.1"
  },
  "devDependencies": {
    "tslint": "^5.8.0",
    "typescript": "^3.1.3"
  },
  "private": true,
  "engines": {
    "node": "8"
  }
}

有人可以解释一下此触发器有什么问题吗? 在节点:6上运行良好 关于版本问题,我在堆栈溢出中看到了相同的问题。

1 个答案:

答案 0 :(得分:0)

升级firebase功能。