【问题标题】:Firebase functions not listening for specific pathFirebase 函数未侦听特定路径
【发布时间】:2017-10-31 11:25:00
【问题描述】:

我在数据库/business/{businessId}/images/{imageId}/imageUrl 中有一条路径 它在创建业务时侦听business,但后来我将图像推送到images,但它不侦听businessImages。我用了下面的监听器。

exports.business = functions.database.ref('/business/{businessId}').onWrite(event => {
    console.log('lorem epsum****', event);
    return true;
});

exports.businessImages = functions.database.ref('/business/{businessId}/images/{imageId}/imageUrl').onWrite(event => {
    console.log('lorem epsum****', event);
    return true;
});

可能是什么问题?

【问题讨论】:

  • 你试过把imageUrl去掉吗?
  • 是的,甚至尝试删除 {imageId}。还是不行。
  • 请更新您的问题以包含您的数据库结构。
  • 如果 businessImages 没有触发,因为业务正在触发,因为它正在监视更高的节点。当您写入 {businessId} 下的任何节点时,您能否确认 export.business 是否触发?
  • 我已经提到过 /business/{businessId}/images/{imageId}/imageUrl like https://console.firebase.google.com/project/xxxxxxxx/database/data/business/-KxmM4e8pWKElDOcfD-b/images/-KxmM4gne1tl0yBbtJ_B/imageUrl

标签: function firebase firebase-realtime-database


【解决方案1】:

谢谢大家的回答,但主要问题是,我在 imageUrl 中插入了整个 base 64 图像,导致侦听或获取 imageUrl 数据的性能最慢。当我删除所有图像时,效果很好。

附:我知道我们应该放置 URL 而不是 base 64 图像。

【讨论】:

    猜你喜欢
    • 2017-09-05
    • 1970-01-01
    • 2017-02-22
    • 2021-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-23
    相关资源
    最近更新 更多