Firebase Firestore云功能显示触发器类型“未知" [英] Firebase firestore cloud functions showing trigger type 'unknown'

查看:59
本文介绍了Firebase Firestore云功能显示触发器类型“未知"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经部署了HTTP和存储触发功能,没有任何问题.当我部署Firestore事件(.onUpdate或.onWrite)函数时,它永远不会触发. 当我查看控制台时(详细信息),我看到列出了具有正确触发器类型的所有函数,但显示未知"的Firestore函数除外.

I've been deployed HTTP and Storage triggered functions with no problems. When I deploy a firestore event (.onUpdate or .onWrite) function it never triggers. When I look at the console (detailed info) I see all my functions with the correct trigger type listed, except for the firestore functions which show 'unknown'.

firebase-tools:firebase-tools@3.16.0

firebase-tools: firebase-tools@3.16.0

以下是两个示例云函数.第一个带有"firestore.document"的"fred"以触发类型显示:"unknown".第二个"makeUpperCase"是一个测试,它会触发实时数据库(我没有真正使用过),但是在加载时,它确实在控制台中显示了正确的触发类型.

Below are two sample cloud functions. The first, 'fred' with 'firestore.document' shows up with trigger type: 'unknown'. The second 'makeUpperCase' is a test that triggers off the Realtime database (which I don't really use) but when it's loaded, it does show the correct trigger type in the console.

我不确定是否遗漏了一些非常简单的内容,或者这是一个Firestore错误. (我确实加载了几个月前使用的Firestore触发功能,但也未能正确触发,这使我怀疑Firestore问题.)

I'm not sure if I'm missing something really simple, or this is a firestore bug. (I did load a firestore trigger function that I had working a few months ago and it also didn't trigger properly, which leads me to suspect Firestore problem.)

export const fred = functions.firestore.document('users/{userId}').onWrite(event => {
    console.error(`fred triggered: ${JSON.stringify(event.data.previous.data())}`);
    return new Promise((resolve, reject) => {

        resolve();
    })
})

exports.makeUppercase = functions.database.ref('/organizations/{pushId}')
    .onWrite(event => {
      // Grab the current value of what was written to the Realtime Database.

      console.log('Uppercasing');
      return new Promise((resolve, reject) => {

        resolve();
    })
    });

推荐答案

Firebase Cloud Functions运行在节点v6.11.5上

Firebase Cloud Functions are running on node v6.11.5

export const fred =.改为使用exports.fred =.

与您的实时数据库示例相同.

Same as with your realtime database example.

这篇关于Firebase Firestore云功能显示触发器类型“未知"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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