Exceeding CPU limit when running wrangler dev on paid plan

I was running into (expected) CPU limit issues on the free tier, so I’ve upgraded to the Paid tier, with a worker using the Unbound usage model. When I deploy my code, it works great, but if I run either wrangler dev or wrangler preview, I’m still getting “Exceeded CPU limit” errors. Anything I can do to fix that? Not great to have to deploy every time I want to test something.

Sorry for the late reply, I would suggest posting in the Workers’ Discord.

1 Like

If CPU time is exceeded Wrangler, it will be exceeded when deployed too, just not directly!
The difference is that in deployment, the worker will fail when it’s getting frequent requests since a worker will allow infrequent requests that consume more than 50ms, in fact it will even allow up to 200ms+ of infrequent requests.

Thanks for the reply!

To clarify a few things: when running wrangler dev and making a single request, it was throwing the error in well under a second, as if it was still enforcing the 50ms limit (despite me upgrading to a paid plan and assigning Unbound for that worker). Similarly, publishing that code and running a single request in production was not throwing the error. This wasn’t a scaling matter, making lots of requests, etc.

Also the request is CPU bound and takes more than 50ms, but not more than a second, so we’re not talking about long 20 - 30 second requests that might time out under Unbound’s limits.

However, I tried again this morning (first time since making this post), after upgrading to a new version of wrangler, and I’m not seeing errors anymore. So not sure if the fact that I had upgraded my account propagated eventually or what, but I’ll post back if I run into it again.

Thanks again :pray:

Ah, getting the error again. The work I’m doing I think hovers right around 50ms, so as I’m adding things to it, it’s exceeding the limit.

Is it expected that CPU limits should be imposed at all in development once I’ve upgraded my account and I’m using Unbound workers?

Uncaught (in response)
Error: Worker exceeded CPU time limit.
    at async Object.e.handleRequest (worker.js:8:28060)

If you have set the Wrangler configuration keys as mentioned in the documentation here:

https://developers.cloudflare.com/workers/cli-wrangler/configuration#keys

usage_model = "unbound"

Then it should work without CPU-limits, if it doesn’t, file a bug report on Github Wrangler Repo.