我正在尝试像在这篇文章中那样部署一个计划好的云函数。
我的/functions/index.js中有两个函数。第一个是https函数,它工作正常,但是englishSyntax没有运行。
exports.helloWorld = functions.https.onRequest((request, response) => {
response.send("Hello from Firebase!");
});
exports.englishSyntax = functions.pubsub
.schedule('every 30 seconds')
.timeZone('America/New_York')
.onRun(context => {
console.log('triggered every 30 secs', context);
});我是最低版本的cron。
"dependencies": {
"firebase-admin": "~7.0.0",
"firebase-functions": "^2.3.0"
},在我的日志查看器中:
2019-08-23 11:18:52.048 EDT
Cloud Scheduler API
CreateJob
us-central1
email@mail.com
INVALID_ARGUMENT详情如下:
status: {
code: 3
message: "INVALID_ARGUMENT"
}
...
resource: {
labels: {
method: ""
project_id: "my-project"
service: ""
}
type: "audited_resource"
}
severity: "ERROR" 这个错误表明了什么?如何修复它,使其按计划运行我的函数?除了函数的状态之外,我在哪里检查console.log输出以验证它是否正常工作?
发布于 2019-08-23 17:17:04
弄明白了。这条错误信息毕竟是准确的。问题是seconds不是一个有效的论点。它需要是minutes或hours。every minute似乎仍然需要一个数字第二arg。这些文档更清楚地说明了语法到底是"English-y“还是”不是“。
https://cloud.google.com/appengine/docs/standard/python/config/cronref#start-time
https://stackoverflow.com/questions/57630110
复制相似问题