如何使用pubsub模拟器在本地调用Firebase Schedule函数 [英] How to invoke firebase Schedule functions locally using pubsub emulator

查看:103
本文介绍了如何使用pubsub模拟器在本地调用Firebase Schedule函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究云功能,尤其是计划功能.我需要每5分钟定期触发一个功能,但仅在测试步骤中.我需要在pubsub模拟器上运行它而不部署它.

I am working on cloud functions especially schedule functions. I need to trigger a function periodically each 5 minutes, but in only test step. I need to run it on pubsub emulator without deploying it.

该怎么做?

我尝试使用Firebase Shell,但只触发了一次

I tried to use firebase shell, but it triggered only once

 exports.scheduledFunctionPlainEnglish =functions.pubsub.schedule('every 2 minutes')
 .onRun((context) => {
    functions.logger.log("this runs every 2 minutes")
    return null;
}) 

推荐答案

计划功能当前不支持此功能. 文档指出:

This is currently not supported for scheduled functions. The documentation states:

使用外壳,您可以模拟数据并执行函数调用,以模拟与Emulator Suite当前不支持的产品的交互:存储, PubSub ,分析,远程配置,存储,身份验证和崩溃分析

Using the shell, you mock data and perform function calls to simulate interaction with products that the Emulator Suite does not currently support: Storage, PubSub, Analytics, Remote Config, Storage, Auth, and Crashlytics.

计划功能是pubsub触发器的不受支持的扩展.

Scheduled functions are an unsupported extension of pubsub triggers.

随时提交具有Firebase支持的功能请求.

这篇关于如何使用pubsub模拟器在本地调用Firebase Schedule函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆