最佳答案
您正在编写旧版本的 firebase-functions 模块的代码。从版本 1.0 开始,onWrite 处理程序采用两个参数 - 一个 Change 对象和一个事件上下文。 Please see the documentation for more details .
exports.commentsCount = functions.database.ref('/comments/{commentId}/{userId}').onWrite((change, context) => {
const commentId = context.params.commentId
})
您还必须调整代码以使用新的更改对象而不是旧的事件对象。
关于javascript - 如何从引用中获取参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50993202/