I have a function that I want to run every 8 seconds. but i am getting error while installing it. It loads when I change the seconds to "every 8 hours". it doesn't give any errors. Does firebase pubsub not accept times in seconds?
const otherMatchBotModule = require("./otherMatchBotActive");
exports.otherMatchBotActive = functions.pubsub.schedule("every 8 seconds").onRun(otherMatchBotModule.otherMatchBot);
console output:
i functions: creating Node.js 14 function otherMatchBotActive(us-central1)...
Functions deploy had errors with the following functions:
otherMatchBotActive(us-central1)
i functions: cleaning up build files...
Error: There was an error deploying functions
log file details:
[debug] [2022-06-28T01:36:49.114Z] Error: Failed to upsert schedule function otherMatchBotActive in region us-central1
at /Users/durak/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:38:11
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Fabricator.upsertScheduleV1 (/Users/durak/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:378:9)
at async Fabricator.setTrigger (/Users/durak/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:347:17)
at async Fabricator.createEndpoint (/Users/durak/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:124:9)
at async handle (/Users/durak/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/deploy/functions/release/fabricator.js:75:17)
[error]
[error] Error: There was an error deploying functions
CodePudding user response:
functions.pubsub.schedule()
uses Cloud Scheduler to schedule running a function. The smallest time granularity is 1 minute.
The following image shows the fields that will be translated from "every 8 seconds" to the Cron job format. Notice that there is no second field, therefore your request is invalid.