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.

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.



Try DigitalOcean for free

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

Sign up