小编Luc*_*ski的帖子

云功能中的云Firestore

我想将新的Cloud Firestore集成到我的云功能中.

我更新了node.js并在我的mac上安装了最新的firebase版本.

文件说:

exports.myFunctionName = functions.firestore
  .document('users/marie').onWrite((event) => {
    // ... Your code here
 });
Run Code Online (Sandbox Code Playgroud)

应该管用.我只是复制代码并将其粘贴到index.js中,就像其他所有实时数据库函数一样.当我部署功能代码($ firebase deploy --only functions)时,我收到此错误:

Cannot read property 'document' of undefined
    at Object.<anonymous> (/private/var/folders/zm/wp2415l929s472jv7kzbt3km0000gn/T/fbfn_21520Y4xqAJosBNHe/index.js:196:45)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
Run Code Online (Sandbox Code Playgroud)

关于这个问题的任何建议/想法?

node.js firebase google-cloud-functions google-cloud-firestore

6
推荐指数
1
解决办法
1072
查看次数