我正在尝试部署一个计划的云功能,如本文所述。
我的/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 protected]
INVALID_ARGUMENT
和细节:
status: {
code: 3
message: "INVALID_ARGUMENT"
}
...
resource: {
labels: {
method: ""
project_id: "my-project"
service: ""
}
type: "audited_resource"
}
severity: "ERROR"
这个错误说明什么?如何修复它以便它按计划运行我的功能?除了函数的状态,我应该在哪里检查console.log
输出以验证它是否正常工作?
弄清楚了。毕竟错误信息是准确的。问题是这seconds
不是一个有效的论点。它必须是minutes
或hours
。似乎every minute
还需要一个数字的第二个 arg。这些文档更清楚地说明了语法到底是不是“英语-y”。
https://cloud.google.com/appengine/docs/standard/python/config/cronref#start-time
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句