本文介绍了适用于Firebase的Cloud Functions:functions.pubsub.topic(' testTopic').onPublish未调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经从云功能的官方文档中复制了此代码段:

I've copied this code snippet from the official documentation of cloud functions:

exports.helloPubSub = functions.pubsub.topic('testTopic').onPublish(event => {
    return console.log("test topic event data", event.data) 
})

该主题存在,该功能已成功部署;如果我向其发送消息,则消息到达了设备,但是没有调用此函数.

The topic exists, the function is deployed successfully; if I send a message to it, the message arrives to the devices, BUT this function does not get called.

有人帮忙吗?

推荐答案

Firebase(Google)云消息传递和Google Cloud Pub/Sub是不同的消息传递系统,例如在此处解释:

Firebase (Google) Cloud Messaging and Google Cloud Pub/Sub are different messaging systems, as explained here:

尽管他们共享主题的概念,但是发送到FCM主题的消息不会触发 Pub/Sub Cloud Function .

Although they share the concept of topics, a message sent to an FCM topic will not trigger a Pub/Sub Cloud Function.

这篇关于适用于Firebase的Cloud Functions:functions.pubsub.topic(' testTopic').onPublish未调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-19 05:38