When trying to request or upload a large file from a Serverless Function, you may have seen a
413: FUNCTION_PAYLOAD_TOO_LARGE error. This is because Serverless Functions have a payload limit of 5mb for request and response bodies. Read on to learn more about how you can work with this limitation.
Serverless Functions are designed to respond quickly to clients and should be treated like a lightweight API layer, not a media server.
If you have a large file like a video that you need to send to a client, you should consider storing those assets in a dedicated media host and make them retreivable with a presigned URL that contains access control policies directly in the URL.
Similary to requesting assets securely, you can upload large files directly to a media host from your browser without needing a Serverless Function as a proxy. Cloudinary, FaunaDB, and AWS S3 are all solutions for this among others.