Skip to content

Commit 6e8dd80

Browse files
authored
Up max asset count to 100k (#10489)
Further work needed in the future to pull the limit from the API and use that instead of having a hardcoded limit. We could remove the limit totally in Wrangler but hving it for dev is nice so this is the best current path.
1 parent 7cb05f5 commit 6e8dd80

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

.changeset/clear-views-scream.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"wrangler": patch
3+
---
4+
5+
Allow Wrangler to upload 100,000 assets inline with the newly increased Workers Paid limit.

packages/workers-editor-shared/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"eslint": "^8.57.1",
4343
"react": "^18.3.1",
4444
"react-dom": "^18.3.1",
45+
"typescript": "catalog:default",
4546
"vite": "catalog:default",
4647
"vite-plugin-dts": "^4.0.1"
4748
},

packages/workers-shared/utils/constants.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ export const ENTRY_SIZE = PATH_HASH_SIZE + CONTENT_HASH_SIZE + TAIL_SIZE;
2323

2424
// -- Manifest creation constants --
2525
// used in wrangler dev and deploy
26-
/** Maximum number of assets that can be deployed with a worker */
27-
export const MAX_ASSET_COUNT = 20_000;
28-
/** Maximum size per asset that can be deployed with a worker */
26+
/**
27+
* Maximum number of assets that can be deployed with a Worker; this is a global
28+
* ceiling, and may vary by the user's subscription.
29+
*/
30+
export const MAX_ASSET_COUNT = 100_000;
31+
/** Maximum size per asset that can be deployed with a Worker */
2932
export const MAX_ASSET_SIZE = 25 * 1024 * 1024;
3033

3134
export const CF_ASSETS_IGNORE_FILENAME = ".assetsignore";

packages/wrangler/src/assets.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { parseStaticRouting } from "@cloudflare/workers-shared/utils/configurati
66
import {
77
CF_ASSETS_IGNORE_FILENAME,
88
HEADERS_FILENAME,
9-
MAX_ASSET_COUNT,
109
MAX_ASSET_SIZE,
1110
REDIRECTS_FILENAME,
1211
} from "@cloudflare/workers-shared/utils/constants";
@@ -263,7 +262,6 @@ const buildAssetManifest = async (dir: string) => {
263262
logReadFilesFromDirectory(dir, files);
264263

265264
const manifest: AssetManifest = {};
266-
let counter = 0;
267265

268266
const { assetsIgnoreFunction, assetsIgnoreFilePresent } =
269267
await createAssetsIgnoreFunction(dir);
@@ -287,15 +285,6 @@ const buildAssetManifest = async (dir: string) => {
287285
assetsIgnoreFilePresent
288286
);
289287

290-
if (counter >= MAX_ASSET_COUNT) {
291-
throw new UserError(
292-
`Maximum number of assets exceeded.\n` +
293-
`Cloudflare Workers supports up to ${MAX_ASSET_COUNT.toLocaleString()} assets in a version. We found ${counter.toLocaleString()} files in the specified assets directory "${dir}".\n` +
294-
`Ensure your assets directory contains a maximum of ${MAX_ASSET_COUNT.toLocaleString()} files, and that you have specified your assets directory correctly.`,
295-
{ telemetryMessage: "Maximum number of assets exceeded" }
296-
);
297-
}
298-
299288
if (filestat.size > MAX_ASSET_SIZE) {
300289
throw new UserError(
301290
`Asset too large.\n` +
@@ -318,7 +307,6 @@ const buildAssetManifest = async (dir: string) => {
318307
hash: hashFile(filepath),
319308
size: filestat.size,
320309
};
321-
counter++;
322310
}
323311
})
324312
);
@@ -340,7 +328,7 @@ function logAssetUpload(line: string, diffCount: number) {
340328
" (truncating changed assets log, set `WRANGLER_LOG=debug` environment variable to see full diff)";
341329
logger.info(chalk.dim(msg));
342330
}
343-
return diffCount++;
331+
return ++diffCount;
344332
}
345333

346334
/**

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)