Worker exceeded resource limits
I deployed my site and it's working, but if I refresh it a few (~6) times in a row then I get an Error 1102 exceeded resource limits.
What can I do to prevent this?
13 Replies
use the new pricing model
@Yatsuki but shouldn't this not be a problem at all? Shouldn't the response be cached?
well idk how workers caching works but id try to implement my own cache logic
Workers sit in front of Cloudflare's cache, so using the cache API won't prevent the worker from being invoked.
@PurpleBlob but what can I do about the CPU time? Like the site loads fine but if you refresh a few time it gets that error? Shouldn't each load time be independent?
https://offer-template.pages.dev/
Enforcing the limits is done quite leniently, so you can go over once in a while - I think it uses the mean to check if your worker should be terminated
And if you reload the page a couple times, causing that mean to go up, you suddenly start getting 1102s
plus you get some leniency on the first time your script is loaded on that machine, some ~400ms for worker startup time
Under your Pages Project under Function Metrics you should be able to see your Median CPU Time
I'm guessing it's super high and you have some issue with doing something really expensive each request, could be a dependency or something
![No description](https://cdn.answeroverflow.com/1191785501259214978/Screenshot_2024-01-02_at_11.49.59_AM.png)
I guess the free tier is only 10ms?
and I'm basically always over that
yes
also yes, which explains your issue
You really shouldn't need 300ms to render or load a page, something is wrong. You're using Nuxt?
yes Nuxt
I'll see if any optimizations can be done
probably something to do with loading / replacing for the translations
I ran into this problem today while I was doing a bunch of things on a heavier page. It first said I was over limits with a pretty HTML page, then all subsequent loads reported for all other pages (non- prerendered) as 'Not found' with a simple text response.
Are there no alerts on this? Kind of disturbing that users get a simple Not found response rather than the over usage response (over usage appeared once and only once). How would I know what to troubleshoot if I wasn't the one to see that first over usage response? An email or something recommending an upsell or whatever would work.
This was with a sveltekit pages app, so everything not prerendered failed.