如何在firestore触发云功能上设置选项
{memory: "1GiB"}
。
我在文档中找不到它:https://firebase.google.com/docs/functions/2nd-gen-upgrade
有一个 https 函数的示例,但 onDocumentCreated() 等似乎有不同的语法。
export const statisticsDataCreated = onDocumentCreated("statistics/data", async (event) => {
/** Do things **/
});
你找到实现它的方法了吗?
据我在此处的文档中看到(https://firebase.google.com/docs/functions/manage-functions?gen=2nd&hl=it#set_timeout_and_memory_allocation)
选项可以作为回调函数本身之前的第一个参数传递:
exports.convertLargeFile = onObjectFinalized({
timeoutSeconds: 300,
memory: "1GiB",
}, (event) => {
// Do some complicated things that take a lot of memory and time
});
虽然没有关于 onDocumentCreated 触发器的具体示例,但我建议您像这样使用它:
export const statisticsDataCreated = onDocumentCreated({memory: "1GiB"}, "statistics/data", async (event) => {
/** Do things **/
});