Skip to content

Commit 6833339

Browse files
authored
[Workers] Update worker-size limits docs (#22642)
* simplify meaning text (avoid wrap, remove XXMB phrasing) * consolidate remediation recommendations to limits doc (size-err doesn't belong in 10021 section anyhow) * add 64M uncompressed limit (always existed; never documented) * mention Assets for hosting static assets
1 parent 48dcbac commit 6833339

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

src/content/docs/workers/observability/errors.mdx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ These errors occur when a Worker is uploaded or modified.
190190
| `10016` | Invalid Worker name. |
191191
| `10021` | Validation Error. Refer to [Validation Errors](/workers/observability/errors/#validation-errors-10021) for details. |
192192
| `10026` | Could not parse request body. |
193-
| `10027` | Your Worker exceeded the size limit of XX MB (for more details see [Worker size limits](/workers/platform/limits/#worker-size)) |
193+
| `10027` | The uploaded Worker exceeded the [Worker size limits](/workers/platform/limits/#worker-size). |
194194
| `10035` | Multiple attempts to modify a resource at the same time |
195195
| `10037` | An account has exceeded the number of [Workers allowed](/workers/platform/limits/#number-of-workers). |
196196
| `10052` | A [binding](/workers/runtime-apis/bindings/) is uploaded without a name. |
@@ -206,14 +206,6 @@ The 10021 error code includes all errors that occur when you attempt to deploy a
206206

207207
Specific error cases include but are not limited to:
208208

209-
#### Worker exceeded the upload size limit
210-
211-
A Worker can be up to 10 MB in size after compression on the Workers Paid plan, and up to 3 MB on the Workers Free plan.
212-
213-
To reduce the upload size of a Worker, you should consider removing unnecessary dependencies and/or using Workers KV, a D1 database or R2 to store configuration files, static assets and binary data instead of attempting to bundle them within your Worker code.
214-
215-
Another method to reduce a Worker's file size is to split its functionality across multiple Workers and connect them using [Service bindings](/workers/runtime-apis/bindings/service-bindings/).
216-
217209
#### Script startup exceeded CPU time limit
218210

219211
This means that you are doing work in the top-level scope of your Worker that takes [more than the startup time limit (400ms)](/workers/platform/limits/#worker-startup-time) of CPU time.

src/content/docs/workers/platform/limits.mdx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ Each environment variable has a size limitation of 5 KB.
273273

274274
## Worker size
275275

276-
A Worker can be up to 10 MB in size _after compression_ on the Workers Paid plan, and up to 3 MB on the Workers Free plan.
276+
A Worker can be up to 10 MB in size _after compression_ on the Workers Paid plan, and up to 3 MB on the Workers Free plan. On either plan, a Worker can be up to 64 MB _before compression_.
277277

278278
You can assess the size of your Worker bundle after compression by performing a dry-run with `wrangler` and reviewing the final compressed (`gzip`) size output by `wrangler`:
279279

@@ -286,7 +286,13 @@ wrangler deploy --outdir bundled/ --dry-run
286286
Total Upload: 259.61 KiB / gzip: 47.23 KiB
287287
```
288288

289-
Note that larger Worker bundles can impact the start-up time of the Worker, as the Worker needs to be loaded into memory. You should consider removing unnecessary dependencies and/or using [Workers KV](/kv/), a [D1 database](/d1/) or [R2](/r2/) to store configuration files, static assets and binary data instead of attempting to bundle them within your Worker code.
289+
Note that larger Worker bundles can impact the start-up time of the Worker, as the Worker needs to be loaded into memory.
290+
291+
To reduce the upload size of a Worker, consider some of the following strategies:
292+
293+
- Removing unnecessary dependencies and packages
294+
- Storing configuration files, static assets, and binary data using [Workers KV](/kv/), [R2](/r2/), [D1](/d1/), or [Workers Static Assets](/workers/static-assets/) instead of bundling them within your Worker code.
295+
- Splitng functionality across multiple Workers and connecting them using [Service bindings](/workers/runtime-apis/bindings/service-bindings/).
290296

291297
---
292298

0 commit comments

Comments
 (0)