NextJS Builds Always Fail

Hey! Happy holidays and thank you for all your hard work. I stumbled across this post about speeding up nextjs builds, however it seems like so far my deployment has been installing dependencies for 10 minutes. That seems like a bit too long?

EDIT: All of my builds have failed.

Have you thought about adding a caching layer for those deps or maybe some docker magic? React native (RIP) deployments took up only 1-2 mins each.

I saw someone on another thread discussing how they had large files being passed around somewhere, but I don’t think I have any substantial file sizes, unless they’re counting node_modules?

In any case- this seems definitely possible to have <2m deploys. I use codespaces and that’s about how long it takes on there (granted with my cached deps).

yeah, this build failed due to >250mb function size. there’s no way i accidentally uploaded that much data into the repo.

i’ll try to find a workaround but hopefully this is fixed soon :frowning: i just swapped my whole codebase into nextjs.

here’s some stats about my project size:

Hey there,

We do provide Build cache with Deployment and ideally you shouldn’t upload node_modules when you push a code. Our build system will generate after you deploy the application. This multiple Installing required dependencies looks very suspicious. Do you have a reproducible steps which we can look at? I cannot reproduce with Next.js starter template unfortunately.

I definitely didn’t upload node_modules, but I evaluated my project’s build size and it is building to 100mb (already a lot, I have no idea how that happened, but under the 250 limit). Unfortunately I don’t have any reproduceable steps, but I don’t mind you poking around my project.

My guess is something is wrong internally with vercel’s building of nextjs + fastapi projects. I actually started from the nextjs + fastapi template and added quite a bit of code with shadcn + v0 outputs and my own code.

I have no idea, but I was hoping to push this big release today :frowning:

I’ve had like 4 failures for trying to create workarounds (latest one here). I am really not sure how to proceed. You must have many nextjs + fastapi projects deploying successfully.

It seems to be “Serverless Functions” of which I have 1 python endpoint. I tried reducing my pip dependencies with no luck. It’s one tiny function. It can’t be >250mb…

BTW- why use aws’ lambda functions instead of just managing your own kube cluster? seems like you have some good devops engineers. with that, you could write your own autoscaling serverless functions setup without any limitations on docker container sizes and caching and such.

well, to address this quickly for my launch (im hoping to launch tonight) i’ve started using pulumi to deploy straight to GCP and noticed that the standard nextjs docker image is almost a full GB in size.

i’m not sure if vercel pushes these containers to aws lambda, but I’d imagine this being the reason for widespread failures.

Hi,

For Serverless Functions, the maximum uncompressed size is 250 MB including layers which are automatically used depending on runtimes. These limits are enforced by AWS.

You can use includeFiles and excludeFiles to specify items which may affect the function size, however the limits cannot be configured. These configurations are not supported in Next.js, instead use outputFileTracingIncludes.

yeah it’s the python serverless functions (i can’t edit the title or original post) ballooning to >250mb. it’s unclear why.

i think maybe because vercel isn’t using dockerfile copy ignores potentially?

re: python deploys

just a heads up on this thread: i’ve disabled my vercel deployments for the time being, vercel is great but the python backend was a requirement for my project, so i’ve decided to build the infrastructure from scratch.

if you guys patch this, ill definitely be willing to hop back on, but for now provisioning my own containers with full control was the only way i was able to deploy my code.

1 Like