firebase - Firebase Cloud Function 计划功能未运行
问题描述
我正在尝试我的第一个预定的云功能。为了测试,我尝试每 1 分钟运行一次,稍后会增加。
我已经部署了它,但还没有看到它通过 Firebase 日志运行。
这是我部署的内容:
const fetchMovies = require('./data/fetchMovies');
exports.fetchMovies = functions.pubsub.schedule('every 1 minute').onRun((context) => {
console.log("Running, with this context:", context)
fetchMovies.handler(db);
});
知道这里可能有什么不正确吗?
解决方案
一个5分钟的例子...
exports.scheduledFunction = functions.pubsub.schedule('every 5 minutes').onRun((context) => {
console.log('This will be run every 5 minutes!');
return null;
});
Google Cloud Scheduler 支持 Unix Crontab 和 AppEngine 语法。
exports.scheduledFunctionCrontab = functions.pubsub.schedule('5 11 * * *')
.timeZone('America/New_York') // Users can choose timezone - default is America/Los_Angeles
.onRun((context) => {
console.log('This will be run every day at 11:05 AM Eastern!');
return null;
});
推荐阅读
- python - 如何根据 Python/Pandas/R 中计算读出的关键字访问 TSV 的列值?
- keycloak - Keycloak:发送电子邮件时如何添加抄送或密送?
- javascript - excel导出ag-grid中的列固定
- python - 将文件作为参数的脚本没有看到文件,给出没有这样的文件或目录
- html - 如何在 div 中居中 div?
- c++ - 如果 const 不分配内存,为什么我可以得到 const 的地址?
- css - 如何全局导入 react-native 样式类
- typescript - TypeScript 通用键/属性类型保护
- python - jinja django编码中endfor的TemplateSyntaxError
- java - 使用 post API 在 java 中访问不记名令牌