Skip to content

Commit db7011d

Browse files
update Cron Triggers to match expected behaviour in cloudflare/workers-sdk#9266
1 parent adba065 commit db7011d

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/content/docs/workers/configuration/cron-triggers.mdx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ crons = [ "*/3 * * * *", "0 15 1 * *", "59 23 LW * *" ]
9898

9999
</WranglerConfig>
100100

101-
You also can set a different Cron Trigger for each [environment](/workers/wrangler/environments/) in your [Wrangler configuration file](/workers/wrangler/configuration/). You need to put the `[triggers]` table under your chosen environment. For example:
101+
You also can set a different Cron Trigger for each [environment](/workers/wrangler/environments/) in your [Wrangler configuration file](/workers/wrangler/configuration/). You need to put the `triggers` array under your chosen environment. For example:
102102

103103
<WranglerConfig>
104104

@@ -221,11 +221,24 @@ To delete a Cron Trigger on a deployed Worker via the dashboard:
221221
2. Go to **Workers & Pages**, and select your Worker.
222222
3. Go to **Triggers** > select the three dot icon next to the Cron Trigger you want to remove > **Delete**.
223223

224-
:::note
224+
#### Via the [Wrangler configuration file](/workers/wrangler/configuration/)
225225

226-
You can only delete Cron Triggers using the Cloudflare dashboard (and not through your Wrangler file).
226+
If a Worker is managed with Wrangler, Cron Triggers should be exclusively managed through the [Wrangler configuration file](/workers/wrangler/configuration/).
227227

228-
:::
228+
When deploying a Worker with Wrangler any previous Cron Triggers are replaced with those specified in the `triggers` array.
229+
230+
- If the `crons` property is an empty array then all the Cron Triggers are removed.
231+
- If the `triggers` or `crons` property are `undefined` then the currently deploy Cron Triggers are left in-place.
232+
233+
<WranglerConfig>
234+
235+
```toml
236+
[triggers]
237+
# Remove all cron triggers:
238+
crons = [ ]
239+
```
240+
241+
</WranglerConfig>
229242

230243
## Limits
231244

0 commit comments

Comments
 (0)