"Error: Size of uploaded file exceeds 300MB"

Hello Community!

I am relatively new to Python, but I recently developed a project using FastAPI and crewai.
The project runs fine locally.
However, when I try to deploy it on Vercel, I encounter the following error:
“Error: Size of uploaded file exceeds 300MB”

Here’s some context:

  • requirements.txt
    fastapi==0.115.6
    crewai==0.86.0
    crewai-tools==0.17.0
    pydantic==2.8.2
    openai==1.57.2
    langchain==0.3.10
    uvicorn==0.32.1

  • .vercelignore
    .git/
    .venv/
    pycache/
    .pytest_cache/
    .mypy_cache/
    node_modules/
    *.log
    *.sqlite3
    *.pyc
    .DS_Store
    .env
    build/
    dist/
    *.tar.gz
    *.zip

Despite adding .vercelignore to exclude unnecessary files, I still encounter the same error.

Has anyone faced a similar issue?
How can I resolve this and deploy my project on Vercel successfully?

Thanks in advance for your help!

This can happen when your function is built and the bundle size exceeds our 250MB maximum.

You can use the vercel build CLI command and check the .vercel/output folder to help you identify the source of the problem. Alternatively, you could remove the functions and dependencies one by one until the project is deployed successfully.

After you find the cause, you can use includeFiles and excludeFiles to control the function size. More details are available in the bundle size limits and vercel.json configuration docs.

Thanks @amyegan
I’ll give it a try

1 Like

I’ve tried vercel build and got this error.

Vercel CLI 39.3.0
WARN! Due to `builds` existing in your configuration file, the Build and Development Settings defined in your Project Settings will not apply. Learn More: https://vercel.link/unused-build-settings
Error: Unable to find any supported Python versions.
Learn More: http://vercel.link/python-version