Sss*_*eve 2 firebase google-cloud-functions firebase-cli
如今,Firebase的Cloud Functions的新功能正在按计划运行功能。因此,我尝试测试示例代码。
exports.scheduledFunction = functions.pubsub.schedule(‘every 5 minutes’).onRun((context) => {
console.log(‘This will be run every 5 minutes!’);
});
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试部署它时,出现以下错误消息:
Error: Error occurred while parsing your function triggers.
TypeError: functions.pubsub.schedule is not a function
Run Code Online (Sandbox Code Playgroud)
我的Firebase工具版本为6.7(今天更新)
解决办法是什么?
我在这里检查了示例git代码(https://github.com/firebase/functions-samples/blob/master/delete-unused-accounts-cron/functions/index.js)
但这也会导致相同的错误:
functions.pubsub.schedule不是函数
谁能帮助我解决这个问题?
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
exports.scheduledFunction = functions.pubsub.schedule('every 5 minutes').onRun((context) => {
console.log('This will be run every 5 minutes!');
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1839 次 |
| 最近记录: |