workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

🐛 BUG: Incorrect "too many crons" error

Open ImPlotzes opened this issue 3 years ago • 1 comments

What version of Wrangler are you using?

2.0.24

What operating system are you using?

Linux

Describe the Bug

I'm wrongly getting workers.api.error.too_many_crons [code: 10072].

I'm on the Workers free plan, which has a maximum of 5 Cron Triggers per account. I have 4 already active Cron Triggers divided over 2 Workers, one script has 3 Cron Triggers and the other one has 1 Cron Trigger. I'm trying to publish the Worker that has 3 Cron Trigger again (just a normal code update) and I get that " too many crons" error.

My theory is that it sees that my account currently has 4 total Cron Triggers. Then when I want to upload the Worker it thinks 3 more Cron Triggers are getting added, thus 4 + 3 > 5. In fact, the 3 Cron Triggers in the script I'm trying to upload are already on my account, there are no new Cron Triggers.

ImPlotzes avatar Aug 07 '22 16:08 ImPlotzes

We will investigate, we may have more questions once we have started looking into it. Thank you! 😄

JacobMGEvans avatar Aug 09 '22 16:08 JacobMGEvans

Quick win to reproduce it reliably.

JacobMGEvans avatar Aug 15 '22 15:08 JacobMGEvans

I've encountered the same issue with wrangler publish with wrangler 2.0.24.

My wrangler file has the line crons = ["0 * * * *", "0 0 * * 1", "0 0 1 * *"]. It works fine the first time I publish but I get the error "workers.api.error.too_many_crons" on every subsequent publish. The workaround it to delete the crons via the dashboard before publishing.

Also weird, trying to delete a cron trigger via the dashboard also says "You've reached your cron limit" when there a 4 cron triggers on the account (3 in service A and 1 in service B). Deleting service B allowed to delete a trigger on service A).

All the triggers were created via wrangler.toml

jmlnik avatar Aug 18 '22 08:08 jmlnik

Just to update here—we've confirmed this is a issue and are working on fixing it (as you suspected, the issue is with the addition of old triggers and replaced triggers)

penalosa avatar Aug 23 '22 17:08 penalosa

This should be fixed going forward as of the next release

penalosa avatar Sep 02 '22 16:09 penalosa