A Serverless Function has exceeded the unzipped maximum size #4354
Replies: 22 comments 34 replies
-
Hi @cannonmaster! I just created a new project from the Next.js Flask Starter template and didn't run into this problem. Did I use the wrong template? |
Beta Was this translation helpful? Give feedback.
-
I am also running into the same problem in a NextJS+FastAPI application. I started getting this error when deploying in Vercel for my Pro account after many successful previous deployments:
This problem is running me nuts, and I don't know how to debug it. A previous version of a deployment worked perfectly. Don't know what I could changed that caused this problem. I think it could be a limit or error from Vercel in terms of how many times I have run deployments. Indeed last two days I have run so many of them because I was getting familiar with the functionality of the platform. When reviewing the size of the latest build (checking the size of my As a reference, I attach below the list of dependencies I am using: NextJS
FastAPI
Also here is the link to the GitHub project if someone wants to review it entirely. I would appreciate any support! Regards, Samuel |
Beta Was this translation helpful? Give feedback.
-
I'm getting the same issue, I tried building locally and deploying, which successfully deployed but then I get 405 errors when actually calling the function. Looking at the logs it can't find the module I've imported |
Beta Was this translation helpful? Give feedback.
-
I had this issue with a Nuxt 2 app in combination with vercel-builder. vercel-builder suggests to use Yarn due to its autoclean functionality. I was already using Yarn, but not the autoclean functionality. After setting this up the error message disappeared and my deployments were successful again. |
Beta Was this translation helpful? Give feedback.
-
Try Removing the local env folder "env" from your git repo |
Beta Was this translation helpful? Give feedback.
-
How do I even find out if it's a Python or JS serverless function? This is extremely frustrating. |
Beta Was this translation helpful? Give feedback.
-
Can we get an update on this? It seems this issue has been outstanding for months now. |
Beta Was this translation helpful? Give feedback.
-
Been having this error for a month now with Next.js. My pre-built .vercel folder is 38MB unzipped so not sure what would be 250MB large or which "function" this would be. |
Beta Was this translation helpful? Give feedback.
-
I see a bunch of Python process outputs in my root folder when I run vercel build so maybe its something to do with setting the build output directory? |
Beta Was this translation helpful? Give feedback.
-
Bizarre. I was able to get it to build if I deleted my public, lib, other root level folders as well as thin out the app folder to a simple page. I have no idea why this would cause the python function bundle size to be affected (I am not importing anything from my other files and even replaced the Python code with the simple Flask Hello World example and it still gave the same error). I tried excludeFiles but did not work. Any configuration someone can share that basically excludes all files from my python function? |
Beta Was this translation helpful? Give feedback.
-
In my case, looking at the build system report (set
Now I understand that Then I get this error:
So I commented out the code using After removing the Thus, the error is connected to the This fits into the narrative of other users having had success with explicitly excluding
|
Beta Was this translation helpful? Give feedback.
-
Thanks. I tried this but unfortunately did not work for me. I even tried the kitchen sink:
but no dice. I've narrowed it down to my public folder growing past a certain size. If i take a big subfolder out the build runs otherwise I get the error. Are we sure outputFileTracingExcludes works for Python functions in api folder at the root level or just for the Next.js ones in app/api? |
Beta Was this translation helpful? Give feedback.
-
I have the same issue (" A Serverless Function has exceeded the unzipped maximum size of 250 MB. : https://vercel.link/serverless-function-size"), I tried to remove as much as possible of non-needed packages but nothing changed, this is my installed packages from vercel: I'm such at this point now, no idea how to figure it out, note that all those packages size on my local is less then even 200MB |
Beta Was this translation helpful? Give feedback.
-
我使用3.9 3.10 3.11 3.12 都不能解决这个问题 太失望了 |
Beta Was this translation helpful? Give feedback.
-
Is thing going to be solved? |
Beta Was this translation helpful? Give feedback.
-
i can my project as public so they can try to deploy and produce the error, but where are they?! |
Beta Was this translation helpful? Give feedback.
-
Having the same issue. My Vue/Nuxt application is not even that complex.
Unable to deploy changes. |
Beta Was this translation helpful? Give feedback.
-
Same here! Using a python-only fastAPI app with the template as starting point but fails for this reason, with no clues on how to debug it. Running
a bit of tweaking requirements shows |
Beta Was this translation helpful? Give feedback.
-
same here, got a light next + flask build. Deployed fine a couple of times, the poof. Can't solve it with the CLI either because of API limits in the free version |
Beta Was this translation helpful? Give feedback.
-
Try adding a
|
Beta Was this translation helpful? Give feedback.
-
I am trying to deploy a FastAPI from a Turborepo as detailed in https://github.com/cording12/next-fast-turbo with a few extra packages, but no luck. Even tried deploying it by itself, but same error. Then tried the
Deploying FastAPI in a Turborepo seems even more bugged when not using |
Beta Was this translation helpful? Give feedback.
-
Weird, but nice: Successfully deployed on Redeploy. |
Beta Was this translation helpful? Give feedback.
-
Summary
I am using the next-flask template from vercel as the start point of my project.
The issue is on deploy stage, and the error is " A Serverless Function has exceeded the unzipped maximum size of 250 MB". It clearly indicates the dependencies size is over the limit.
First, I went to measure the size of the deps installed on both frontend and backend (flask), and none of them has abnormal size.
Then, I used vercel cli to build the project locally to list what's actually installed for each individual serverless functions during the build stage.
To my superise, vercel installed bunch of deps for my project automatically even almost all of them is not related to my project.
In addition, most of them have a fairly large size such as numpy (this is not used in the project even).
I think that this causes the oversize errors and of course currently not be able to deploy on vercel.
I have stucked on this issue whole day and tried to find solution everywhere but no luck.
Does someone could share some solution to solve it ...
For your reference, here is the deps used by my backend,
Flask==2.2.2
supabase==1.0.4
python-dotenv==1.0.0
qdrant-client==1.5.4
Flask-Limiter==3.5.0
Flask-Cors==4.0.0
langchain==0.0.304
langsmith==0.0.41
Example
No response
Steps to Reproduce
a normal build then deploy vercel gives the error
Beta Was this translation helpful? Give feedback.
All reactions