Question

DigitalOcean App Platform response size limit. Not able to return large files

I have successfully deployed a Python (FastAPI) API on the Digital Oceans Apps Platform. There is a POST API endpoint that returns an Excel file as a response. When the file size is 7 KB, it is returning fine. When the file size is 80 KB, a 0 bytes files gets downloaded.

The cURL I am using is similar to

curl -X 'POST' \
  'https://example.com/api' \
  -H 'accept: */*' \
  -H 'header: value' \
  -H 'Content-Type: multipart/form-data' \
  -F 'myfile=@myfile.pdf;type=application/pdf' \
  --output output.xlsx

When the output.xlsx is less than 10 KB, it is getting saved just fine, however when it is more, the output is a 0 bytes file.

Is there a limit on the response size limit on the DO Apps Platform? Could not find any such thing mentioned on https://docs.digitalocean.com/products/app-platform/details/limits/

The API code is similar to https://fastapi.tiangolo.com/advanced/custom-response/#fileresponse

Show comments

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
April 14, 2023

Hi there,

Indeed, the issue with larger response sizes might be encountered due to various factors like network latency, timeouts, or app performance.

I could suggest checking a few things:

  1. Review the logs in the DigitalOcean App Platform dashboard for any error messages or warnings related to your API requests.

  2. Test the API endpoint locally with a larger file size to confirm that the issue is not with your FastAPI application code.

  3. If your API takes a longer time to process larger files, you might be hitting a timeout limit. You can try adjusting the timeout value in your FastAPI app using the Uvicorn worker. For example, you can set the timeout to 120 seconds:

uvicorn myapp:app --host 0.0.0.0 --port 8000 --workers 1 --timeout 120
  1. Instead of sending the whole file at once, you can consider streaming the response using FastAPI’s StreamingResponse. This can help you overcome issues related to large response sizes.

In case none of those things help, please reach out to our amazing support team who will be more than happy to assist you with your issue! :)

https://www.digitalocean.com/support/

Hope that helps!

- 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