Question

413 Payload Too Large

Hi there,

I’m trying to deploy a cloud function with Python using the python-opencv library, however I am getting a 413: Payload Too Large error. I read the documentation and it seems like DigitalOcean only supports a build of 48MB.

Is there anyway to increase this size limit? I know other services like AWS Lambda support up to 200mb.

If not, does anyone have a similar experience of trying to deploy a python function with large requirements? I tried building from the source rather than through pip but it just fails.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
February 3, 2023

Hi there,

Indeed the maximum size of the built function is 48 MB. Basically, everything under <package-name>/<function-name>/ is gathered into a single zip file. The final file needs to be within the 48 MB size limit.

You could try using a .ignore file to ignore any artifacts that you don’t need in order to reduce the overall file size:

Every <package-name>/<function-name>/ folder may contain a .ignore file. This file uses the same format as .gitignore. It specifies artifacts that should not be a part of the deployed function.

https://docs.digitalocean.com/products/functions/reference/build-process/

Is your project open-source? If so feel free to share a link here and I could have a look and see if there is a way to reduce the size.

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel
Get started for free

Enter your email to get $200 in credit for your first 60 days with DigitalOcean.

New accounts only. By submitting your email you agree to our Privacy Policy.

© 2023 DigitalOcean, LLC.