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
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!
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.
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:
Review the logs in the DigitalOcean App Platform dashboard for any error messages or warnings related to your API requests.
Test the API endpoint locally with a larger file size to confirm that the issue is not with your FastAPI application code.
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 theUvicorn
worker. For example, you can set the timeout to 120 seconds: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! :)
Hope that helps!
- Bobby.