小编Sop*_*hia的帖子

有没有办法使用 onSchedule 并使用 Firebase 函数 V2 设置自定义“timeoutSeconds”和“内存”?

我不得不恢复使用 Firebase 函数 V1 来安排函数的运行,并在代码中指定运行时选项,包括 timeoutSeconds 和内存(用 TypeScript 编写):

const runtimeOpts = {
    timeoutSeconds: 540,
    memory: "1GB" as const,
};
exports.cleanupEvents = functions
    .runWith(runtimeOpts)
    .pubsub.schedule("0 0 * * *")
    .timeZone("Europe/Berlin")
    .onRun(async () => {
        await cleanupOldEvents(adminDb);
        logger.log("Event cleanup finished");
    });

Run Code Online (Sandbox Code Playgroud)

有谁知道Firebase函数V2是否可以使用onSchedule语法在代码中指定这些runtimeOpts?无需进入谷歌云控制台并在那里手动设置。

我尝试过将“onSchedule”和“runWith”链接在一起,看看 Emmet 提出的其他可能性,但到目前为止没有运气。

node.js firebase google-cloud-functions

3
推荐指数
1
解决办法
1180
查看次数

标签 统计

firebase ×1

google-cloud-functions ×1

node.js ×1