Build failed: Generated Pages Functions bundle size is over the limit of 25.0 MiB

For Workes & Pages, what is the name of the domain?

What is the error message?

12:36:45.960 Generated Pages Functions bundle size (29977357) is over the limit of 25.0 MiB 12:36:47.225 Failed: generating Pages Functions failed. Check the logs above for more information. If this continues for an unknown reason, contact support: https://cfl.re/3WgEyrH

What is the issue or error you’re encountering

When deploying a Next.js project on Cloudflare, the build output has some page-specific func.js files that exceed 2MB in size. With multiple pages in the project, this causes deployment to fail, resulting in an error: 12:36:45.960 Generated Pages Functions bundle size (29977357) is over the limit of 25.0 MiB 12:36:47.225 Failed: generating Pages Functions failed. Check the logs above for more information. If this continues for an unknown reason, contact support: https://cfl.re/3WgEyrH

What steps have you taken to resolve the issue?

12:36:45.624 Attaching additional modules:
12:36:45.646 ┌─────────────────────────────────────────────────────────────────────────────────────┬──────┬─────────────┐
12:36:45.646 │ Name │ Type │ Size │
12:36:45.647 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.647 │ next-on-pages-dist/cache/adaptor.js │ esm │ 2.29 KiB │
12:36:45.647 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.647 │ next-on-pages-dist/cache/cache-api.js │ esm │ 0.43 KiB │
12:36:45.647 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.648 │ next-on-pages-dist/cache/kv.js │ esm │ 0.35 KiB │
12:36:45.648 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.648 │ next-on-pages-dist/functions/[locale]/api/email/support.func.js │ esm │ 327.51 KiB │
12:36:45.648 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.648 │ next-on-pages-dist/functions/[locale]/api/query/random-boy-names.func.js │ esm │ 330.71 KiB │
12:36:45.648 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.648 │ next-on-pages-dist/functions/[locale]/api/query/random-city-names.func.js │ esm │ 330.74 KiB │
12:36:45.649 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.649 │ next-on-pages-dist/functions/[locale]/api/query/random-girl-names.func.js │ esm │ 330.72 KiB │
12:36:45.649 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.649 │ next-on-pages-dist/functions/[locale]/api/query/random-last-names.func.js │ esm │ 330.74 KiB │
12:36:45.649 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.649 │ next-on-pages-dist/functions/[locale]/api/query/random-names.func.js │ esm │ 330.63 KiB │
12:36:45.649 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.649 │ next-on-pages-dist/functions/[locale]/api/query/random-town-names.func.js │ esm │ 330.73 KiB │
12:36:45.650 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.650 │ next-on-pages-dist/functions/[locale]/api/server-date.func.js │ esm │ 233.22 KiB │
12:36:45.650 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.650 │ next-on-pages-dist/functions/[locale]/api/update-meaning.func.js │ esm │ 359.25 KiB │
12:36:45.650 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.650 │ next-on-pages-dist/functions/[locale]/api/upload.func.js │ esm │ 226.63 KiB │
12:36:45.650 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.650 │ next-on-pages-dist/functions/[locale]/city-name-generator.func.js │ esm │ 2100.34 KiB │
12:36:45.651 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.651 │ next-on-pages-dist/functions/[locale]/discover/[category]/[currentPage].func.js │ esm │ 1694.53 KiB │
12:36:45.651 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.651 │ next-on-pages-dist/functions/[locale]/discover/[category].func.js │ esm │ 1696.92 KiB │
12:36:45.651 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.651 │ next-on-pages-dist/functions/[locale]/error.func.js │ esm │ 1573.51 KiB │
12:36:45.651 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.651 │ next-on-pages-dist/functions/[locale]/faqs.func.js │ esm │ 1593.46 KiB │
12:36:45.652 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.652 │ next-on-pages-dist/functions/[locale]/generate.func.js │ esm │ 2109.99 KiB │
12:36:45.652 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.653 │ next-on-pages-dist/functions/[locale]/girl-name-generator.func.js │ esm │ 2109.34 KiB │
12:36:45.654 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.654 │ next-on-pages-dist/functions/[locale]/last-name-generator.func.js │ esm │ 2110.01 KiB │
12:36:45.654 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.655 │ next-on-pages-dist/functions/[locale]/name/[id].func.js │ esm │ 1684.65 KiB │
12:36:45.655 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.655 │ next-on-pages-dist/functions/[locale]/privacy.func.js │ esm │ 1578.02 KiB │
12:36:45.655 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.655 │ next-on-pages-dist/functions/[locale]/support.func.js │ esm │ 1823.30 KiB │
12:36:45.655 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.656 │ next-on-pages-dist/functions/[locale]/terms.func.js │ esm │ 1579.07 KiB │
12:36:45.656 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.656 │ next-on-pages-dist/functions/[locale]/town-name-generator.func.js │ esm │ 2102.18 KiB │
12:36:45.656 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.656 │ next-on-pages-dist/functions/[locale].func.js │ esm │ 1612.05 KiB │
12:36:45.656 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.657 │ next-on-pages-dist/functions/middleware.func.js │ esm │ 261.09 KiB │
12:36:45.657 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.657 │ next-on-pages-dist/manifest/27d10e462fba646daaa29468a0656e12.js │ esm │ 1.75 KiB │
12:36:45.657 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.657 │ next-on-pages-dist/manifest/__RSC_SERVER_MANIFEST.js │ esm │ 1.10 KiB │
12:36:45.657 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.657 │ next-on-pages-dist/webpack/09856d46055678fc688816af05e48cb5.js │ esm │ 95.62 KiB │
12:36:45.657 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.657 │ next-on-pages-dist/webpack/163dbe3258b68176903094cfacce674e.js │ esm │ 5.95 KiB │
12:36:45.658 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.658 │ next-on-pages-dist/webpack/1e142782d277e5062f74bbdd24086b47.js │ esm │ 173.04 KiB │
12:36:45.658 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.658 │ next-on-pages-dist/webpack/69ffb824ef2af40da182c65f39f72416.js │ esm │ 8.47 KiB │
12:36:45.658 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.658 │ next-on-pages-dist/webpack/9189cb92bb607eb6106b99c9931c6b6e.js │ esm │ 9.88 KiB │
12:36:45.658 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.658 │ next-on-pages-dist/webpack/dcb06e4e584749f60180ebaa95e74b57.js │ esm │ 34.80 KiB │
12:36:45.659 ├─────────────────────────────────────────────────────────────────────────────────────┼──────┼─────────────┤
12:36:45.659 │ next-on-pages-dist/webpack/f3a9375bccf6fd11bbc597337481e50f.js │ esm │ 113.29 KiB │
12:36:45.659 └─────────────────────────────────────────────────────────────────────────────────────┴──────┴─────────────┘
12:36:45.704 :sparkles: Compiled Worker successfully
12:36:45.960 Generated Pages Functions bundle size (29977357) is over the limit of 25.0 MiB
12:36:47.225 Failed: generating Pages Functions failed. Check the logs above for more information. If this continues for an unknown reason, contact support: https://cfl.re/3WgEyrH

Hi,

Thank you for reaching out to us.

I am afraid the maximum file size for a single Cloudflare Pages site asset is 25 MiB. It is currently a hard limit.

You can consider using R2 for large files, you can check below for more details:

I hope this helps.

Kindly,