gpt4 book ai didi

javascript - 错误 : Cloud function needs to be called with an event parameter. Firebase 控制台错误,

转载 作者:行者123 更新时间:2023-11-30 06:16:21 24 4
gpt4 key购买 nike

我已经将 firebase node 版本从 6 升级到 8,还升级了 firebase-functions、typescript 版本以及 firebase-admin。但是我在几个触发器上遇到了这个错误。

Error: Cloud function needs to be called with an event parameter.If >you are writing unit tests, please use the Node module firebase-?>functions-fake. at Object. (/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我在堆栈溢出中看到了关于版本问题的相同问题。

最佳答案

升级 firebase 函数。

关于javascript - 错误 : Cloud function needs to be called with an event parameter. Firebase 控制台错误,,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55903286/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com