Hi everyone. So I have a NextJS app (<15.0.0) and was trying to deploy to pages. My has both server

Hi everyone. So I have a NextJS app (<15.0.0) and was trying to deploy to pages. My has both server and client functions and is still relatively small. While trying to deploy I see the files in /.next/cache are larger than the 25mb limit. Tried to troubleshoot to optimize where I can (don't have many static assets and they're small). Build direct was set to /.next and npm run build as the command. Am I doing something wrong or is it plainly a matter of refactoring everything to use Cloudflare workers?
17 Replies
Nexorsist
NexorsistOPā€¢2mo ago
I'm still in early stages of Dev and while I have been deploying onto my local server and serving it up that way, thought it would be convenient to test out Pages instead
matbrgz
matbrgzā€¢2mo ago
Subject: Build Failure Due to Bundle Size Limit Exceeded Hi everyone, I'm experiencing an issue while deploying my Next.js app on Cloudflare Pages. The build fails with this error:
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
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
Earlier in the logs, it mentions:
Generated Pages Functions bundle size (26272676) is over the limit of 25.0 MiB
Generated Pages Functions bundle size (26272676) is over the limit of 25.0 MiB
It seems my bundle size exceeds the 25 MiB limit. Here's a snippet from the build log:
Total (231 modules) ā”‚ ā”‚ 25488.77 KiB ā”‚
...
Generated Pages Functions bundle size (26272676) is over the limit of 25.0 MiB
Total (231 modules) ā”‚ ā”‚ 25488.77 KiB ā”‚
...
Generated Pages Functions bundle size (26272676) is over the limit of 25.0 MiB
I believe the large number of modules and functions is causing the issue. Does anyone have advice on how to reduce the bundle size or handle this situation? Or how to check bundle size? Thanks in advance!
MarcusAurelius
MarcusAureliusā€¢2mo ago
Does the new worker's framework platform have support for cron ? If i have a nextjs app deployed can i add a scheduled trigger to the function ? Does anyone know how to run a cronjob with open-next cloudflare, nextjs 15 ?
Hello, Iā€™m Allie!
Workers with Assets are also able to export a Scheduled Handler for Crons. As for whether open-next itself supports it, I am not sure
Chapi
Chapiā€¢2mo ago
Hey guys Was working on nextjs on CF pages and I always use binding on the API side now I wanted to use on server actions and it is saying only async function are allowed to be used in use server. File but the getRequestContext method is not async I think. Does anyone knows how to use since I kinda need the bindings to work.
No description
matbrgz
matbrgzā€¢2mo ago
Generated Pages Functions bundle size (26282201) is over the limit of 25.0 MiB 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 How to check bundle side? How to understand which file is causing this?
No description
D Trombett
D Trombettā€¢2mo ago
Remove the export const runtime = "edge". It is not needed in use server files
Chapi
Chapiā€¢2mo ago
It is needed for any server side code. The issue is with the context which is a sync function and all server actions functions must be async
D Trombett
D Trombettā€¢2mo ago
No it's not, the error is clearly highlighting that line. I use server actions too and can confirm that the runtime option is unavailable/not needed. Do ensure that you have it in your root layout or in single pages, tho Also, about the context, you're calling getRequestContext() inside an async function so it's totally fine
James
Jamesā€¢2mo ago
Heya, can you open an issue on the opennext-cloudflare repo for cron support The problem is that you're exporting the runtime from an action file. Actions don't need that. You only need to export the runtime from either a layout or a page file
MarcusAurelius
MarcusAureliusā€¢2mo ago
Sure šŸ‘šŸ»
dzoni
dzoniā€¢2mo ago
Hi everyone, my CF builds for next.js just stopped with a message
15:10:34.718 ā–² TypeError: Cannot read properties of undefined (reading 'data')
15:10:34.718 ā–² at N (/opt/buildhome/repo/.next/server/app/_not-found/page.js:120:23074)
15:10:34.719 ā–² at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
15:10:34.719 ā–² digest: '879041786'
15:10:34.719 ā–² }
15:10:34.718 ā–² TypeError: Cannot read properties of undefined (reading 'data')
15:10:34.718 ā–² at N (/opt/buildhome/repo/.next/server/app/_not-found/page.js:120:23074)
15:10:34.719 ā–² at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
15:10:34.719 ā–² digest: '879041786'
15:10:34.719 ā–² }
and nothing has changed in the config, I am not using the not found page it is auto-generated. Has anyone experienced similar? UPDATE: Just fixed by itself after some time, really strange šŸ˜„
James
Jamesā€¢2mo ago
Sounds like a Next.js issue
putty
puttyā€¢2mo ago
I'm aware that the edge runtime builds as required/requested or something like that but I was wondering request times should by in the 6-8s realm?
James
Jamesā€¢2mo ago
Sounds odd. Maybe it's network requests inside the app or very large component trees?
putty
puttyā€¢2mo ago
I do have an API it calls that does roughly take 6s but I have a skeleton UI that should display whilst it's doing so. It functions as intended with the skeleton UI when I'm testing locally.
Unknown User
Unknown Userā€¢2mo ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?