Javascript 在development env中使用云函数实时更新Firestore

Javascript 在development env中使用云函数实时更新Firestore,javascript,firebase,google-cloud-firestore,google-cloud-functions,Javascript,Firebase,Google Cloud Firestore,Google Cloud Functions,实时更新在我的开发环境中不适用于firebase Service。当部署到生产环境中时,它运行良好 exports.onApplyCreated = functions.firestore .document('users/{userId}') .onWrite((change, context) => { const data = change.after.data() const userId = context.params.userI

实时更新在我的开发环境中不适用于
firebase Service
。当部署到生产环境中时,它运行良好

exports.onApplyCreated = functions.firestore
    .document('users/{userId}')
    .onWrite((change, context) => {
        const data = change.after.data()
        const userId = context.params.userId

        console.log('New apply <${userId}>')
        return "Done."
    });
exports.onApplyCreated=functions.firestore
.document('users/{userId}')
.onWrite((更改、上下文)=>{
const data=change.after.data()
const userId=context.params.userId
console.log('newapply')
返回“完成”
});

当使用
service
时,shell中没有打印日志,但是当登录到生产环境中时,它工作得很好。

您需要在本地运行时调用它们,如前所述。@Kato我明白了,感谢您提供链接。我希望将来会有一种像生产一样测试它的方法。
exports.onApplyCreated = functions.firestore
    .document('users/{userId}')
    .onWrite((change, context) => {
        const data = change.after.data()
        const userId = context.params.userId

        console.log('New apply <${userId}>')
        return "Done."
    });