Stay organized with collections
Save and categorize content based on your preferences.
The builder for scheduled functions, which are powered by Google Pub/Sub and Cloud Scheduler. Describes the Cloud Scheduler job that is deployed to trigger a scheduled function at the provided frequency. For more information, see [Schedule functions](/docs/functions/schedule-functions).
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-04-24 UTC."],[],[],null,["# pubsub.ScheduleBuilder class\n\nThe builder for scheduled functions, which are powered by Google Pub/Sub and Cloud Scheduler. Describes the Cloud Scheduler job that is deployed to trigger a scheduled function at the provided frequency. For more information, see \\[Schedule functions\\](/docs/functions/schedule-functions).\n\nAccess via `functions.pubsub.schedule()`.\n\n**Signature:** \n\n export declare class ScheduleBuilder \n\nConstructors\n------------\n\n| Constructor | Modifiers | Description |\n|----------------------------------------------------------------------------------------------------------------------------|-----------|----------------------------------------------------------|\n| [(constructor)(triggerResource, options)](./firebase-functions.pubsub.schedulebuilder.md#pubsubschedulebuilderconstructor) | | Constructs a new instance of the `ScheduleBuilder` class |\n\nMethods\n-------\n\n| Method | Modifiers | Description |\n|--------------------------------------------------------------------------------------------------------|-----------|-----------------------------------------------------------------------------------------------------------------|\n| [onRun(handler)](./firebase-functions.pubsub.schedulebuilder.md#pubsubschedulebuilderonrun) | | Event handler for scheduled functions. Triggered whenever the associated scheduler job sends a Pub/Sub message. |\n| [retryConfig(config)](./firebase-functions.pubsub.schedulebuilder.md#pubsubschedulebuilderretryconfig) | | |\n| [timeZone(timeZone)](./firebase-functions.pubsub.schedulebuilder.md#pubsubschedulebuildertimezone) | | |\n\npubsub.ScheduleBuilder.(constructor)\n------------------------------------\n\nConstructs a new instance of the `ScheduleBuilder` class\n\n**Signature:** \n\n constructor(triggerResource: () =\u003e string, options: DeploymentOptions);\n\n### Parameters\n\n| Parameter | Type | Description |\n|-----------------|--------------------------------------------------------------------------------------------|-------------|\n| triggerResource | () =\\\u003e string | |\n| options | [DeploymentOptions](./firebase-functions.deploymentoptions.md#deploymentoptions_interface) | |\n\npubsub.ScheduleBuilder.onRun()\n------------------------------\n\nEvent handler for scheduled functions. Triggered whenever the associated scheduler job sends a Pub/Sub message.\n\n**Signature:** \n\n onRun(handler: (context: EventContext) =\u003e PromiseLike\u003cany\u003e | any): CloudFunction\u003cunknown\u003e;\n\n### Parameters\n\n| Parameter | Type | Description |\n|-----------|----------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------|\n| handler | (context: [EventContext](./firebase-functions.eventcontext.md#eventcontext_interface)) =\\\u003e PromiseLike\\\u003cany\\\u003e \\| any | Handler that fires whenever the associated scheduler job sends a Pub/Sub message. |\n\n**Returns:**\n\n[CloudFunction](./firebase-functions.cloudfunction.md#cloudfunction_interface)\\\u003cunknown\\\u003e\n\nA function that you can export and deploy.\n\npubsub.ScheduleBuilder.retryConfig()\n------------------------------------\n\n**Signature:** \n\n retryConfig(config: ScheduleRetryConfig): ScheduleBuilder;\n\n### Parameters\n\n| Parameter | Type | Description |\n|-----------|--------------------------------------------------------------------------------------------------|-------------|\n| config | [ScheduleRetryConfig](./firebase-functions.scheduleretryconfig.md#scheduleretryconfig_interface) | |\n\n**Returns:**\n\n[ScheduleBuilder](./firebase-functions.pubsub.schedulebuilder.md#pubsubschedulebuilder_class)\n\npubsub.ScheduleBuilder.timeZone()\n---------------------------------\n\n**Signature:** \n\n timeZone(timeZone: string): ScheduleBuilder;\n\n### Parameters\n\n| Parameter | Type | Description |\n|-----------|--------|-------------|\n| timeZone | string | |\n\n**Returns:**\n\n[ScheduleBuilder](./firebase-functions.pubsub.schedulebuilder.md#pubsubschedulebuilder_class)"]]