Error: A Serverless Function has exceeded the unzipped maximum size of 250 MB. : https://vercel.link/serverless-function-size

I am trying to deploy my python project with fastapi using vercel, but keep on facing this error: Error: A Serverless Function has exceeded the unzipped maximum size of 250 MB. : Limits.
this is my vercel.json:
{
“builds”: [
{
“src”: “/api/main.py”,
“use”: “@vercel/python”,
“config”: {
“excludeFiles”: “/{.next,.cache,node_modules,public,app}/**"
}
}
],
“routes”: [
{
“src”: "/(.
)”,
“dest”: “api/main.py”
}
]

}

this is my build system report.
▲ Build system report

14:18:20.586• No memory or disk space problems detected

14:18:20.586• Folder sizes on disk:

14:18:20.586 ‣ Input source code: 234 MB

14:18:20.586 ‣ Build cache: <1 MB

14:18:20.586 ‣ Output files: 3 MB

14:18:20.586 ‣ Node modules: 157 MB

14:18:20.586• No files larger than 100 MB detected on disk

How can deploy my application without this error

Hi, @vdatttiwari-complian! Welcome to the Vercel Community :smile:

It looks like you exceeded the maximum size of 250 MB on your project.

From the documentation:

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.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Just wanted to flag that Vercel has doubled the Python Functions bundle size limit — it’s now 500MB unzipped (previously 250MB).

If your FastAPI project was close to or just over the old 250MB cap, you should be able to redeploy as-is without needing to trim dependencies. Hope this helps!

Reference: Python Vercel Functions bundle size limit increased to 500MB - Vercel