Cloud Functions中的Cloud Firestore [英] Cloud Firestore in Cloud Functions

查看:59
本文介绍了Cloud Functions中的Cloud Firestore的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将新的Cloud Firestore集成到我的Cloud Functions中.

I want to integrate the new Cloud Firestore to my Cloud Functions.

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

I updated node.js and installed the latest firebase version on my mac.

文档说:

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

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

should work. I just copied the code and pasted it into the index.js, like every other realtime database functions. When I deploy the function code ($firebase deploy --only functions), i get this error:

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)

关于这个问题有什么建议/想法吗?

Any suggestions/ideas on the problem?

推荐答案

好的,我尝试了所有这些事情,但是没有成功.但是firebase带来了一个更新,现在可以了:)

Alright, i tried all these things, but it didn't work out. But firebase brought out an update, now it works :)

似乎他们有一些错误.

感谢您的帮助!

这篇关于Cloud Functions中的Cloud Firestore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆