node.jscloudflarecloudflare-workerstomlwrangler

How to provide usage_model at wrangler.toml for cloudflare


I am trying to change usage model at the Cloudflare worker from bundled to unbound, due to exceeded compute performance capacity and requiring more even to startup my nodejs(Nitrojs, Nuxt3 and RavenDB client) app.

CI message:

Your Worker failed validation because it exceeded startup limits.

  To ensure fast responses, we place constraints on Worker startup -- like how much CPU it can use, or how long it can take.
  Your Worker failed validation, which means it hit one of these startup limits.
  Try reducing the amount of work done during startup (outside the event handler), either by removing code or relocating it inside the event handler.

Switched model at UI and saw Your last deployment was from Wrangler. Changes to these bindings should also be updated in your wrangler.toml file.. After clicking on Save I received message that it may not be applied just now.

Next, I changed toml file, but seems to be usage_model=unbound is wrong, but bundled works.

Error message from CI

 workers.api.error.wrong_plan [code: 10075]
  
  If you think this is a bug, please open an issue at: https://github.com/cloudflare/workers-sdk/issues/new/choose

wrangler.toml

name = "webui"
main = "./.output/server/index.mjs"
workers_dev = false
compatibility_date = "2022-09-10"
...
usage_model="unbound"
[site]
bucket = ".output/public"

Could someone describe correct usage_model values and possibly configuration for compute node limitation values.


Solution

  • I was just fiddling with this as well. Looks like you can actually remove the field usage_model entirely as per the following warning:

    ▲ [WARNING] The usage_model defined in wrangler.toml is deprecated and no longer used. Visit our developer docs for details: https://developers.cloudflare.com/workers/wrangler/configuration/#usage-model

    Recommend updating to the latest wrangler version and removing the usage_model from the config altogether.