简体   繁体   English

带有 Firebase 数据库触发器的第二代 Google Cloud Functions

[英]Google Cloud Functions 2nd Generation with Firebase Database trigger

I'm trying to update my function from cloud function 1st generation (java 11) to 2nd generation.我正在尝试将我的 function 从第一代云 function (java 11) 更新到第二代。 Apparently some changes imply that the old implementation of the functions through Cloud CLI doesn't work on the new cloud functions.显然,一些更改意味着通过 Cloud CLI 实现的旧功能不适用于新的云功能。 The old trigger was setting by this command:旧触发器是通过此命令设置的:

--trigger-event providers/google.firebase.database/eventTypes/ref.create \
--trigger-resource projects/_/instances/root/message/{message_id}

Is still possible to run a function on "OnCreate" trigger from firebase database?仍然可以在 firebase 数据库的“OnCreate”触发器上运行 function 吗? It looks like it could be reach with the EventArc, but I don't find anywhere how to do that.看起来它可以通过 EventArc 到达,但我找不到任何地方如何做到这一点。 Someone is already doing that or can clarify this?有人已经在这样做或者可以澄清这一点?

As per the comment of @DazWilkin, there's an existing public issue tracker for this issue.根据@DazWilkin 的评论,此问题有一个现有的公共问题跟踪器 As per the contents of the issue (as of March 18, 2022): "Cloud functions team identified the issue: the flag doesn't support the event because it only supports PubSub and GCS events, the team is going to change the message to be more specific."根据问题内容(截至 2022 年 3 月 18 日):“云功能团队确定了问题:该标志不支持该事件,因为它仅支持 PubSub 和 GCS 事件,该团队将消息更改为更加详细一些。”

On this note, there's a preview limitation stated in the official Firebase documentation (as of March 29, 2022):关于这一点,官方 Firebase 文档(截至 2022 年 3 月 29 日)中规定了预览限制

Cloud Functions (2nd gen) offers Pub/Sub, Cloud Storage and Audit Log events through Eventarc. Cloud Functions(第 2 代)通过 Eventarc 提供发布/订阅、云存储和审计日志事件。 Additional events for Firestore, Firebase RTDB, Analytics, and Auth are planned.计划为 Firestore、Firebase RTDB、Analytics 和 Auth 举办更多活动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM