How to debug function script over the 1 MiB size limit?

Hi @ncormier, I have the same error, but I’m wondering how to debug the worker size. This is for a pages remix app (Remix · Cloudflare Pages docs)

I’ve attached my logs below. The files to my eye, before compression, seem to be well below 1MB. How do I find what’s actually being uploaded, and why it’s so large?

2024-05-27T17:05:21.300328Z	Cloning repository...
2024-05-27T17:05:22.224312Z	From 
2024-05-27T17:05:22.224777Z	 * branch            0d064d1bd4f9944d44bc66b1ec2614c9d1e1aac0 -> FETCH_HEAD
2024-05-27T17:05:22.224878Z	
2024-05-27T17:05:22.277779Z	HEAD is now at 0d064d1 remove chart js to reduce size
2024-05-27T17:05:22.278233Z	
2024-05-27T17:05:22.362693Z	
2024-05-27T17:05:22.363188Z	Using v2 root directory strategy
2024-05-27T17:05:22.389756Z	Success: Finished cloning repository files
2024-05-27T17:05:24.096233Z	Checking for configuration in a wrangler.toml configuration file (BETA)
2024-05-27T17:05:24.096875Z	
2024-05-27T17:05:24.097034Z	Found wrangler.toml file. Reading build configuration...
2024-05-27T17:05:24.102711Z	pages_build_output_dir: build/client
2024-05-27T17:05:24.102877Z	Build environment variables: (none found)
2024-05-27T17:05:24.22237Z	Successfully read wrangler.toml file.
2024-05-27T17:05:24.375776Z	Detected the following tools from environment: [email protected], [email protected]
2024-05-27T17:05:24.376475Z	Installing project dependencies: npm clean-install --progress=false
2024-05-27T17:05:26.048103Z	npm WARN EBADENGINE Unsupported engine {
2024-05-27T17:05:26.048415Z	npm WARN EBADENGINE   package: undefined,
2024-05-27T17:05:26.048566Z	npm WARN EBADENGINE   required: { node: '>=20.0.0' },
2024-05-27T17:05:26.0487Z	npm WARN EBADENGINE   current: { node: 'v18.17.1', npm: '9.6.7' }
2024-05-27T17:05:26.048821Z	npm WARN EBADENGINE }
2024-05-27T17:05:28.379056Z	npm WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
2024-05-27T17:05:28.405772Z	npm WARN deprecated [email protected]: Please use @jridgewell/sourcemap-codec instead
2024-05-27T17:05:29.644586Z	npm WARN deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
2024-05-27T17:05:37.986235Z	
2024-05-27T17:05:37.986563Z	added 926 packages, and audited 927 packages in 13s
2024-05-27T17:05:37.98673Z	
2024-05-27T17:05:37.986862Z	260 packages are looking for funding
2024-05-27T17:05:37.987017Z	  run `npm fund` for details
2024-05-27T17:05:37.9884Z	
2024-05-27T17:05:37.988553Z	found 0 vulnerabilities
2024-05-27T17:05:38.012453Z	Executing user command: npm run build
2024-05-27T17:05:38.604884Z	
2024-05-27T17:05:38.605184Z	> build
2024-05-27T17:05:38.60535Z	> remix vite:build
2024-05-27T17:05:38.605522Z	
2024-05-27T17:05:41.123468Z	e[36mvite v5.2.11 e[32mbuilding for production...e[36me[39m
2024-05-27T17:05:41.185614Z	transforming...
2024-05-27T17:05:45.341579Z	e[32m✓e[39m 1676 modules transformed.
2024-05-27T17:05:45.357741Z	Generated an empty chunk: "_.stats".
2024-05-27T17:05:45.48621Z	rendering chunks...
2024-05-27T17:05:45.583748Z	computing gzip size...
2024-05-27T17:05:45.595598Z	e[2mbuild/client/e[22me[32m.vite/manifest.json              e[39me[1me[2m  2.54 kBe[22me[1me[22me[2m │ gzip:  0.47 kBe[22m
2024-05-27T17:05:45.595947Z	e[2mbuild/client/e[22me[2massets/e[22me[35mtailwind-CrPCtjUX.css     e[39me[1me[2m 26.10 kBe[22me[1me[22me[2m │ gzip:  5.76 kBe[22m
2024-05-27T17:05:45.596123Z	e[2mbuild/client/e[22me[2massets/e[22me[36m_.stats-l0sNRNKZ.js       e[39me[1me[2m  0.00 kBe[22me[1me[22me[2m │ gzip:  0.02 kBe[22m
2024-05-27T17:05:45.596259Z	e[2mbuild/client/e[22me[2massets/e[22me[36mping-B-k49ON1.js          e[39me[1me[2m  0.14 kBe[22me[1me[22me[2m │ gzip:  0.14 kBe[22m
2024-05-27T17:05:45.596368Z	e[2mbuild/client/e[22me[2massets/e[22me[36m_-AmbLXO69.js             e[39me[1me[2m  0.63 kBe[22me[1me[22me[2m │ gzip:  0.41 kBe[22m
2024-05-27T17:05:45.596488Z	e[2mbuild/client/e[22me[2massets/e[22me[36mroot-pu37YtSp.js          e[39me[1me[2m  1.64 kBe[22me[1me[22me[2m │ gzip:  0.96 kBe[22m
2024-05-27T17:05:45.596591Z	e[2mbuild/client/e[22me[2massets/e[22me[36mjsx-runtime-Bvn29G2V.js   e[39me[1me[2m  8.24 kBe[22me[1me[22me[2m │ gzip:  3.11 kBe[22m
2024-05-27T17:05:45.596754Z	e[2mbuild/client/e[22me[2massets/e[22me[36mentry.client-CKW8nuz9.js  e[39me[1me[2m 11.63 kBe[22me[1me[22me[2m │ gzip:  4.09 kBe[22m
2024-05-27T17:05:45.596877Z	e[2mbuild/client/e[22me[2massets/e[22me[36m_._index-CGVOWTvU.js      e[39me[1me[2m 55.69 kBe[22me[1me[22me[2m │ gzip: 16.28 kBe[22m
2024-05-27T17:05:45.597049Z	e[2mbuild/client/e[22me[2massets/e[22me[36mindex-Ke5eJTHV.js         e[39me[1me[2m 59.84 kBe[22me[1me[22me[2m │ gzip: 20.85 kBe[22m
2024-05-27T17:05:45.59717Z	e[2mbuild/client/e[22me[2massets/e[22me[36m_.signup-4xEO31Jy.js      e[39me[1me[2m116.30 kBe[22me[1me[22me[2m │ gzip: 33.19 kBe[22m
2024-05-27T17:05:45.597297Z	e[2mbuild/client/e[22me[2massets/e[22me[36mcomponents-BVZHlKh7.js    e[39me[1me[2m228.64 kBe[22me[1me[22me[2m │ gzip: 73.84 kBe[22m
2024-05-27T17:05:45.597415Z	e[32m✓ built in 4.45se[39m
2024-05-27T17:05:45.92316Z	e[36mvite v5.2.11 e[32mbuilding SSR bundle for production...e[36me[39m
2024-05-27T17:05:45.929363Z	transforming...
2024-05-27T17:05:46.120849Z	e[32m✓e[39m 33 modules transformed.
2024-05-27T17:05:46.144068Z	rendering chunks...
2024-05-27T17:05:46.145755Z	e[2mbuild/server/e[22me[32m.vite/manifest.json           e[39me[1me[2m 0.31 kBe[22me[1me[22m
2024-05-27T17:05:46.145944Z	e[2mbuild/server/e[22me[2massets/e[22me[35mtailwind-CrPCtjUX.css  e[39me[1me[2m26.10 kBe[22me[1me[22m
2024-05-27T17:05:46.146258Z	e[2mbuild/server/e[22me[36mindex.js                      e[39me[1me[2m52.53 kBe[22me[1me[22m
2024-05-27T17:05:46.147362Z	e[32m✓ built in 223mse[39m
2024-05-27T17:05:46.206734Z	Finished
2024-05-27T17:05:46.207443Z	Found Functions directory at /functions. Uploading.
2024-05-27T17:05:47.680204Z	✨ Compiled Worker successfully
2024-05-27T17:05:47.759874Z	Found _routes.json in output directory. Uploading.
2024-05-27T17:05:47.775107Z	Validating asset output directory
2024-05-27T17:05:48.478844Z	Deploying your site to Cloudflare's global network...
2024-05-27T17:05:51.43291Z	Parsed 2 valid header rules.
2024-05-27T17:05:52.7068Z	Uploading... (11/13)
2024-05-27T17:05:53.288375Z	Uploading... (12/13)
2024-05-27T17:05:53.348226Z	Uploading... (13/13)
2024-05-27T17:05:53.348457Z	✨ Success! Uploaded 2 files (11 already uploaded) (1.04 sec)
2024-05-27T17:05:53.34884Z	
2024-05-27T17:05:53.638633Z	✨ Upload complete!
2024-05-27T17:05:55.69663Z	Success: Assets published!
2024-05-27T17:05:58.084102Z	Error: Failed to publish your Function. Got error: Your Functions script is over the 1 MiB size limit (workers.api.error.script_too_large)