解决Firebase模拟器的忽略功能

时间:2019-08-06 13:45:28

标签: firebase google-cloud-firestore google-cloud-functions firebase-cli

我正在根据此处的文档启动我的云功能仿真器:

firebase emulators:start --only functions

onRequest函数看起来很顺利

i  Starting emulators: ["functions"]
⚠  Your requested "node" version "8" doesn't match your global version "10"
✔  functions: Emulator started at http://localhost:5001
i  functions: Watching "/Users/.../functions" for Cloud Functions...
i  functions: HTTP trigger initialized at http://localhost:5001/sweever-prod/us-central1/sendMailTrigger
i  functions: HTTP trigger initialized at http://localhost:5001/sweever-prod/us-central1/sitemapData

但是在有onTrigger函数时会掉下去:

Ignoring trigger "newUserSignedUp" because the Cloud Firestore emulator is not running.
Ignoring trigger "newItemAdded" because the Cloud Firestore emulator is not running.
Ignoring trigger "itemUpdated" because the Cloud Firestore emulator is not running.

onTrigger函数在本地被忽略的原因是什么?考虑到文档参考,我认为Firestore 可以在本地处理这些问题:“可以模拟以下功能类型的Cloud Functions仿真器:... Cloud Firestore函数。”我认为onTrigger将是Cloud Firestore函数,但可能会混淆术语。

1 个答案:

答案 0 :(得分:1)

如果要为多个产品(托管和Firestore)运行仿真器,则应使用以下命令启动仿真器:

firebase emulators:start

现在,您只是为不涉及Firestore的功能启动模拟器。有关更多信息,请参阅documentation