I'm working on an application and our Back-end is written in .NET Web APi Core and Front-end in React. I make an endpoint which gets a JSON list and the size of the list is almost 83 MB. When I, deploy my back-end into AWS Lambda and call my endpoint it gives me an error (Error converting the response object of type Amazon.Lambda.APIGatewayEvents.APIGatewayProxyResponse from the Lambda function to JSON: Unable to expand the length of this stream beyond its capacity.: JsonSerializerException). I already check the Lambda payload response limit is 6 MB, (storing data into S3 from lambda endpoint and then call into Front-End will not work for me), so is there any way I can get that much data through Lambda.
1
votes
Anything beyond 6MB is too much data for a single endpoint. If you have 83MB, either you're returning binary data (e.g base64 strings), or your json has millions of objects/arrays, both scenarios don't make sense from an API perspective. For binary data, consider storing them in S3 and returning just the S3 URL from the API to your frontend. For millions objects, there is no way an end user wants millions objects, you may wanna add some filters and limit the results.
- Alisson
1 Answers
0
votes
Not with a single call, sorry, you cannot. As described in this link, the payload limit (for synchronous call) is, as you say, 6MB. Asynchronous calls have even lower limits.
I'd suggest you modify your UI/API to narrow your results first, or trap this error and alert the user (or calling service) that the payload is too large (and hence should be aborted, narrowed, or split into multiple calls).