-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exceeded maximum allowed payload size #1815
Comments
Issue reproducible using below code: ...
[Route("api/[controller]")]
public class ValuesController : ControllerBase
{
private IHttpContextAccessor _httpContextAccessor;
public ValuesController(IHttpContextAccessor httpContextAccessor)
{
_httpContextAccessor = httpContextAccessor;
}
// GET api/values
[HttpGet]
public IEnumerable<string> Get()
{
string val1 = new string('*', 7 * 1024 * 1024); // 7MB string
return new string[] { val1, "value2" };
}
... In CloudWatch logs, error with {
"errorMessage": "Exceeded maximum allowed payload size (6291556 bytes).",
"errorType": "RequestEntityTooLarge"
} The front-end will get a @schmallaria I'm unsure if you could intercept the exception thrown by Lambda runtime. May be you could check the payload size returned by your downstream SOAP services and throw custom model object containing error property and status code to the calling client? Thanks, |
@ashishdhingra, checking downstream of SOAP Service is not possible. I've tried to use a Global Exception Handler using |
I agree it would be for our library when converting the ASP.NET Core response to the API Gateway response check the size and if it larger then API Gateway can handle return an API Gateway response with the status code set to 413. |
Describe the bug
Hi,
We have an ASP.NET Core Web API running, hosted in a Lambda function. The API uses Top Level Statements and the package Amazon.Lambda.AspNetCoreServer.Hosting.
The function acts as a Proxy Server which enables our API clients to access a lot of legacy SOAP services. In front of the Lambda function there is an API Gateway.
Some of the responses from the SOAP Services exceeds the Lambda response limit of 6MB. When this occurs the underlying Lambda runtime client receives an HTTP 413 error and throws an exception which crashes the whole application, because this happens during startup of the .net application.
I'm not sure if it is a bug or not. How can we handle those errors. In such cases the calling client application should also receive HTTP 413 and not 500.
Regression Issue
Expected Behavior
Application doesn't crash, exception can be handled and send back to the client.
Current Behavior
When response size is greater than 6 MB, Lambda function receives an HTTP 413 error and crashes. The calling client receives a HTTP 500 error, probably because of the crashed application. The exception occurs during startup of the application:
{"errorMessage":"Exceeded maximum allowed payload size (6291556 bytes).","errorType":"RequestEntityTooLarge"}
Reproduction Steps
n/a
Possible Solution
No response
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
Amazon.Lambda.AspNetCoreServer.Hosting 1.7.0
Targeted .NET Platform
.NET Core 8.0
Operating System and version
Docker container
The text was updated successfully, but these errors were encountered: