Published October 21, 2026
How to Monitor Firebase Scheduled Functions
A Firebase scheduled function is a Cloud Scheduler job that deploy creates for you. When that job is paused, the project is not on the Blaze plan, the deploy never landed, or the handler throws, the function does not tell you. The failure is a line in Cloud Logging, or it is nothing at all. Nobody gets a message.
The schedule facts below are the Cloud Functions for Firebase schedule pages, the firebase-functions 7 source (the current stable line, read at 7.4.0), and the Cloud Scheduler cron, retry, and pricing pages. A job you create yourself in Cloud Scheduler, pointed at Cloud Run, is monitoring Cloud Scheduler and Cloud Run. The same silence on another hosted backend is Supabase pg_cron and Vercel Cron. A Linux crontab on a machine you run is crontab not running. The five fields are in cron expression examples. The general pattern is how to monitor cron jobs.
What deploy creates
2nd gen code imports onSchedule from firebase-functions/v2/scheduler. firebase-functions 7 also exports that module as firebase-functions/scheduler, which is the path in the schedule page's sample. Python uses scheduler_fn.on_schedule.
const { onSchedule } = require("firebase-functions/v2/scheduler");
exports.accountcleanup = onSchedule("every day 00:00", async (event) => {
// event.jobName and event.scheduleTime come from the scheduler headers.
});
from firebase_functions import scheduler_fn
@scheduler_fn.on_schedule(schedule="every day 00:00")
def accountcleanup(event: scheduler_fn.ScheduledEvent) -> None:
pass
1st gen is functions.pubsub.schedule(...).timeZone(...).onRun(...). The schedule page still documents that shape.
const functions = require("firebase-functions");
exports.nightly = functions.pubsub
.schedule("0 3 * * *")
.timeZone("America/New_York")
.onRun((context) => {
return null;
});
Deploy creates the scheduler job. For a 2nd gen function it also creates an HTTP function. The default compute service account invokes that function, and the schedule page says only the associated Cloud Scheduler job has permission to run it. The CLI sends that call as HTTP POST with an OIDC token. For a 1st gen function, deploy creates a Pub/Sub topic and a job that publishes to it. The function runs when that message arrives. Pub/Sub targets ignore the attempt deadline.
The CLI names the job firebase-schedule-<function id>-<region>. The 2nd gen page uses that spelling. Its example is firebase-schedule-accountcleanup-us-east1. The 1st gen page still prints the topic as firebase-scheduled-<function>-<region>. In the console, search for firebase-schedule- first. A 2nd gen job lives in the function's region. A 1st gen job lives in the project's App Engine location, which the 1st gen page says you still have to account for on that generation.
The schedule page says not to delete or modify the function or the scheduler job in the console. That can break the next run. A later deploy updates the job when the schedule, time zone, attempt deadline, or retry config changed. Deleting the function through the CLI deletes the job. On 1st gen it also deletes the topic.
Cloud Functions for Firebase requires the Blaze plan. The schedule page says each Cloud Scheduler job costs $0.10 (USD) per month, with an allowance of three jobs per Google account at no charge. The Cloud Scheduler pricing page is the billing rule under that sentence: each billing account gets 3 jobs a month free, then $0.10 per job per 31 days, and a paused job counts as a job. The allowance is per billing account, not per project.
Schedule syntax and the time zone
Cloud Scheduler accepts unix-cron and the App Engine text format. Unix-cron is five fields, with no seconds field:
minute hour day-of-month month day-of-week
Minute 0–59, hour 0–23, day of month 1–31, month 1–12 or JAN–DEC, day of week 0–6 or SUN–SAT. Sunday is also 7. Monday is 1. 0 3 * * * is 03:00 every day. 0 9 * * 1-5 and 0 9 * * MON-FRI are 09:00 Monday through Friday. There is no L. Day of month and day of week are an inclusive OR when both are restricted. If either one is *, only the other field applies.
The App Engine form is the English-like schedule the cron page calls groc. The documented examples include every 5 minutes, every minute, every day 09:00, and every day 00:00. every day 03:00 is that last shape with the hour set to 03:00. That string is not five fields. The cron page says groc is set with the gcloud CLI or the API. Firebase accepts it in the schedule string, which is how onSchedule("every day 00:00") deploys.
timeZone is a tz database name, separate from the schedule string. On 2nd gen the CLI's default is UTC. On 1st gen the CLI's default is America/Los_Angeles, which is also what the comment on the 1st gen sample says. Cloud Scheduler's own default, when a job is created with no time zone, is UTC. Pass the name. timeZone: "America/New_York" on onSchedule, and .timeZone("America/New_York") on the 1st gen builder. Python's argument is timezone, as scheduler_fn.Timezone("America/New_York").
The schedule is wall-clock time in that zone. The cron page says daylight saving time can make a job run or not run, because a local time can disappear or occur twice, and a time that occurs twice can show execution anomalies. It recommends UTC when the cadence has to be exact. The other schedulers are in cron jobs and daylight saving time.
For a unix-cron job, scheduleTime on the event is the scheduled time in RFC3339 UTC, from the X-CloudScheduler-ScheduleTime header. The cron page says that header stays the same across retries, and that groc jobs do not send it. A manual run leaves jobName empty and sets scheduleTime to the time the function actually started.
Retries, timeouts, and a run that is still going
ScheduleOptions carries retryCount, maxRetrySeconds, minBackoffSeconds, maxBackoffSeconds, and maxDoublings. Python uses retry_count, max_retry_seconds, min_backoff_seconds, max_backoff_seconds, and max_doublings. Those fields become the Cloud Scheduler retry config. The names on the job are retryCount, maxRetryDuration, minBackoffDuration, maxBackoffDuration, and maxDoublings.
| Setting | What it does | Default |
|---|---|---|
retryCount |
Retries of one failed attempt | 0. Above 5 is rejected. |
maxRetrySeconds |
Time limit for those retries, from the first try | 0, which is no time limit. With retryCount also 0, there is no retry. |
minBackoffSeconds |
First wait before a retry | 5 seconds |
maxBackoffSeconds |
Cap on that wait | 1 hour |
maxDoublings |
How many times the wait doubles | 5 |
A retryCount of 0 does not cancel future schedules. The next cron time still runs. A non-zero count retries with the backoff until the count is exhausted, the time limit is hit, or the attempt succeeds. If those retries are still going when the next scheduled time arrives, that next time can be skipped.
timeoutSeconds is the function runtime. Leaving it unset means 60 seconds. The SDK treats 0 as unset, and that also becomes 60 seconds. The maximum depends on the trigger, not on the fact that Cloud Scheduler uses HTTP. The manage-functions page and the SDK put scheduled functions and task-queue functions at 1,800 seconds (30 minutes). Event-driven functions cap at 540 seconds. HTTPS and callable functions cap at 3,600 seconds. A 2nd gen scheduled function uses the 1,800 second cap. A 1st gen function, including a scheduled one, caps at 540 seconds.
On 2nd gen, when you set timeoutSeconds, the CLI copies it onto the job's attempt deadline and will not set that deadline below 180 seconds or above 1,800. The HTTP default, when the job has no attempt deadline, is 3 minutes, and the allowed range is 15 seconds to 30 minutes. If the handler has not responded by the deadline, the request is cancelled and the attempt is DEADLINE_EXCEEDED. Pub/Sub targets ignore the field, so a 1st gen job does not use it.
The handler in firebase-functions waits for your function, then answers HTTP 200. A throw is logged and the response is HTTP 500, which is a failed attempt, so retryCount applies. On 1st gen the scheduler attempt is the Pub/Sub publish. retryCount retries a failed publish. It does not re-run a function that already received the message.
Cloud Scheduler will not keep two executions of the same job outstanding. If the next time arrives while the current execution is still going, that start waits. The API's example is an execution scheduled for 16:00 that runs until 16:15: the following execution starts at 16:15. The schedule page also says a function may be triggered more than once, with the next instance running while the previous one is still executing. That is what a 1st gen function does, because the publish returns before onRun finishes, so the next tick can publish again while the first run is still inside the function. Write the handler so a second run is safe. Two overlapping runs are prevent overlapping cron jobs. A run that starts and never returns is cron job stuck or hanging.
What leaves no successful ping
- The deploy failed, or the function was never deployed. There is no job, so nothing runs.
- You are looking at the wrong project, or the job is in another region. The id ends with the function's region. A 1st gen job is in the App Engine location.
- The job is
PAUSED. A user pause does not execute.DISABLEDmeans the system disabled it after an error, and you cannot set that state yourself. - The project is not on the Blaze plan, or billing is disabled. Cloud Functions for Firebase requires Blaze. No function, no job, no ping.
- The handler threw. 2nd gen logs it and returns 500. With
retryCountat 0, that attempt is not retried. The log line is not an email. - The function hit
timeoutSeconds. The default is 60 seconds. - Retries ran out. The next schedule can also be skipped while retries are still in progress.
- The emulator is what you are watching. The Cloud Functions emulator does not include Cloud Scheduler. It emulates HTTPS, callable, task queue, and background triggers from Authentication, Realtime Database, Firestore, Storage, alerts, and Pub/Sub. It dispatches task queues. It does not fire a schedule on the clock. The functions shell can call any trigger with test data. That call is manual.
- The success ping went out before the work, or the handler caught the error and returned.
CRONNUDGE_URLis missing, or the ping request failed. A failure there must not fail the function, so the check is what notices the gap.
CronNudge does not read Cloud Logging, Firebase, or Cloud Scheduler, and it cannot run the function again. It only knows about pings it receives.
Ping after the work succeeds
The success URL is https://cronnudge.com/ping/YOUR_ID. GET, POST, and HEAD all count. A stored ping answers ok. Anyone with that URL can send a ping, so keep it out of source. Read it from parameterized config, a secret, or a .env file in functions/.
defineString("CRONNUDGE_URL") is loaded from .env and deploy asks for the value when it is missing, then writes .env.<projectId>. defineSecret reads Cloud Secret Manager. Bind it with the secrets array or the function cannot read it. A .env entry is process.env.CRONNUDGE_URL in Node and os.environ in Python. Do not put the URL in the schedule string.
Five seconds is long enough for the ping and short enough that a hung request cannot hold the function. Swallow a ping error. A ping that never lands is what the check alerts on, after grace. Send /fail, or ?exit=1, from the work's catch, then rethrow so the 2nd gen handler still logs the error and returns 500. ?exit=1 replaces /fail on that request. 0 is a success. 1 through 255 marks the check down when it was not already down. Anything else is ignored, and the ping stays a success.
const { onSchedule } = require("firebase-functions/v2/scheduler");
const { defineString } = require("firebase-functions/params");
const cronnudgeUrl = defineString("CRONNUDGE_URL");
exports.nightly = onSchedule(
{
schedule: "0 3 * * *",
timeZone: "America/New_York",
timeoutSeconds: 300,
retryCount: 2,
minBackoffSeconds: 10,
maxBackoffSeconds: 60,
maxDoublings: 2,
},
async () => {
const base = cronnudgeUrl.value();
await ping(base, "/start"); // optional; delete this line for a success ping only
try {
await exportReport();
} catch (err) {
await ping(base, "/fail");
throw err;
}
await ping(base, "");
},
);
async function ping(base, path) {
if (!base) return;
try {
await fetch(base + path, { signal: AbortSignal.timeout(5000) });
} catch {
return;
}
}
import os
import urllib.request
from firebase_functions import scheduler_fn
def _ping(path: str) -> None:
base = os.environ.get("CRONNUDGE_URL", "")
if not base:
return
try:
urllib.request.urlopen(base + path, timeout=5).read()
except Exception:
return
@scheduler_fn.on_schedule(
schedule="0 3 * * *",
timezone=scheduler_fn.Timezone("America/New_York"),
timeout_sec=300,
retry_count=2,
)
def nightly(event: scheduler_fn.ScheduledEvent) -> None:
_ping("/start")
try:
export_report()
except Exception:
_ping("/fail")
raise
_ping("")
/fail marks the check down immediately when it was not already down. A second /fail while it is already down does not send another alert. A later success is the recovery: one alert down, one when it comes back. With retryCount above 0, that later success is often the retry. A paused check stores the ping and does not alert.
A function that never starts sends nothing. That silence is the missed success ping, and it is the alert after grace. The emulator, a paused job, and a failed deploy all look like that.
An Idempotency-Key header is cut at 128 characters and matched per check. A repeat of the same key is a replay. It does not record a second ping and it does not send a second alert. X-CloudScheduler-ScheduleTime stays the same across retries of one unix-cron attempt, so it is the wrong key for the success ping. A retry that should count as the recovery needs a new key.
/start and a max runtime
/start records a start. It is not a success. While that start is still open, the deadline is the earlier of the schedule deadline and the start plus grace. The grace used for that run is at least 60 seconds. The alert is down, not stuck. Omit /start and the only clock is the schedule.
Turn on "Track start and finish," or set Max runtime (seconds), which turns run tracking on. A second /start while a run is open is then an overlap alert, and it does not close the first run. A success or /fail closes the open runs. Two success pings alone do not raise an overlap alert.
Max runtime is 1 second through 7 days. With a run open and a max runtime set, the deadline becomes that start plus the max runtime. No finish means one stuck alert, once for that start, and the check goes down. A later success is the recovery. A function the scheduler never starts never calls /start, so it cannot go stuck. Silence until the schedule deadline is the alert. Free includes run tracking on 3 checks. Pro removes that cap. Details are in assertions, runs, and agents.
Set max runtime a little past the longest healthy run. A 1st gen function can still be inside onRun when the next publish arrives, and that second start is the overlap signal once run tracking is on.
Match the check to the schedule
CronNudge stores five fields, minute first, or an interval in seconds. It has no seconds field. Sunday on the check is 0. Monday is 1. Friday is 5. Cloud Scheduler uses that same numbering, and it also accepts 7 for Sunday. Copy a unix-cron schedule onto the check and copy timeZone onto the check's timezone. An interval check stores UTC. The timezone field on the form is for cron.
The form's periods are 5 minutes, 15 minutes, 30 minutes, 1 hour, 6 hours, 1 day, and 1 week. Grace is none, 1 minute, 5 minutes (the default), 15 minutes, or 1 hour. Anything else, from the plan minimum up to 31 days for an interval and from 0 through 7 days for grace, is an API value, and the API is on Pro. Creating a check sets the first deadline from that moment. A success then moves the deadline. An interval counts from the last success. A cron expression uses the next occurrence after that success, then adds grace. The cron tool lists the next runs before grace is added.
Set grace past the longest run and past the retry window. retryCount 0 means the window is the run itself. A non-zero count plus the backoff can land the success ping on a later attempt. If that ping arrives after the deadline, you get one down alert and then the recovery.
Every night at 03:00 in New York. every day 03:00 or 0 3 * * *, with timeZone America/New_York. Check 0 3 * * *, timezone America/New_York. A success at 03:02 is inside the default 5 minutes of grace. The next deadline is 03:05 the next night. A night that never pings alerts at 03:05.
Every 5 minutes. every 5 minutes is the App Engine string. The check is an interval of 5 minutes. That is exactly Free's 5-minute minimum, so it is a Free check. The check counts 5 minutes from the last success, plus grace, and it stores UTC. Unix-cron */5 * * * * is a different schedule: on the clock at :00, :05, :10, and so on. That expression is also a Free check. Use the interval for the App Engine string, and the cron when the function's schedule is */5 * * * *.
Every minute. every minute, or unix-cron * * * * *. The gap is one minute. It is valid cron, and it is not a Free check. Pro's minimum is 1 minute, so it is a Pro check. A schedule that fires more often than the plan minimum cannot be a check at that cadence. Cloud Scheduler's unix-cron has no seconds field, so a sub-minute cadence is not a schedule you can paste, and it is under both minimums.
Weekdays at 09:00 in New York. 0 9 * * 1-5 with timeZone America/New_York. Check 0 9 * * 1-5 in America/New_York. A success at 09:02 is inside the default grace. The next deadline is 09:05 on the next weekday. Saturday and Sunday are not expected.
Free is 10 checks, a 5-minute minimum interval, email plus one Slack or Discord channel, and run tracking on 3 checks. Pro is $12 a month for 100 checks, a 1-minute minimum, signed webhooks, and the API. Details are on pricing.
FAQ
Why is a Firebase scheduled function not running? Deploy creates a Cloud Scheduler job, and nothing sends mail when that job does not fire. The project has to be on the Blaze plan. A paused job does not execute. A job the system disabled after an error does not either. The 2nd gen job id is firebase-schedule-function-region, in the function's region, and the default compute service account is what invokes the HTTP function. A 1st gen job publishes to a Pub/Sub topic and lives in the App Engine location. The emulator does not fire the schedule. A handler that throws is a log line and, on 2nd gen, an HTTP 500.
What time zone does onSchedule use? timeZone is a tz database name and it is not part of the cron string. 2nd gen defaults to UTC. 1st gen defaults to America/Los_Angeles. Cloud Scheduler runs on wall-clock time in that zone. Daylight saving time can make a job run or not run, and a local time that occurs twice can show execution anomalies. UTC is the zone the cron page recommends when the cadence has to be exact. Put the same name on a cron check.
What do retryCount and the timeout do? retryCount defaults to 0, and the maximum is 5. Zero means a failed attempt is not retried, and the next schedule still runs. minBackoffSeconds defaults to 5 seconds, maxBackoffSeconds to 1 hour, and maxDoublings to 5. timeoutSeconds defaults to 60. A 2nd gen scheduled function can run up to 1800 seconds. A 1st gen function caps at 540. Those caps are the scheduled and 1st gen limits. They are not the 3600 second HTTPS cap, even though 2nd gen is invoked over HTTP. The CLI copies a 2nd gen timeout onto the attempt deadline and floors that deadline at 180 seconds. Pub/Sub ignores the attempt deadline.
Does the emulator run a scheduled function? No. The Cloud Functions emulator's documented types are HTTPS, callable, task queue, and background triggers from Authentication, Realtime Database, Firestore, Storage, alerts, and Pub/Sub. It dispatches task queues. It does not create a Cloud Scheduler job, so the clock never fires the schedule. The functions shell can invoke any trigger with test data. That is a manual call. A manual run from the Cloud Scheduler console does invoke the deployed function, and a handler that pings will ping. It does not tell you that a scheduled time was skipped.
How does the schedule become a check? CronNudge stores five fields, minute first, or an interval in seconds. Unix-cron copies straight across. 0 3 * * * with America/New_York is the same string and the same timezone on the check. every 5 minutes is an interval of 5 minutes, which is a Free check. every minute is a one-minute gap, which is a Pro check. Sunday is 0 on the check. Cloud Scheduler also accepts 7 for Sunday. An interval check stores UTC. A schedule that fires more often than the plan minimum cannot be a check at that cadence.
Can CronNudge see Cloud Logging or run the function again? No. It does not read Cloud Logging, Firebase, or Cloud Scheduler, and it cannot run the function again. It only knows about pings it receives. Send the success ping after the work. A throw should send /fail and then rethrow, so the function still records the error. The first /fail while the check is up is one down alert. A retry that later succeeds is the recovery. A function that never starts sends nothing, and that missed ping is the alert after grace.
The schedule only runs if the job Cloud Scheduler created for the function actually fires, and the function only counts if the handler finishes. The ping is how you hear about the run that never called home. Create the check, or read the five fields on the cron tool. Related: how to monitor cron jobs, crontab not running, cron expression examples, Cloud Scheduler and Cloud Run, Supabase pg_cron, Vercel Cron, cron jobs and daylight saving time, prevent overlapping cron jobs, and cron job stuck or hanging.