Skip to content
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

Azure Functions return a 500 if request is too large (HTTP trigger) #10519

Open
bastbu opened this issue Oct 10, 2024 · 1 comment
Open

Azure Functions return a 500 if request is too large (HTTP trigger) #10519

bastbu opened this issue Oct 10, 2024 · 1 comment

Comments

@bastbu
Copy link

bastbu commented Oct 10, 2024

Check for a solution in the Azure portal

Azure Functions have a configurable request size limit for HTTP triggers. The behavior of Kestrel, when a too large payload is encountered, is to return a 413, which indicates to the client that the issue is a too large request on the client side and cannot be retried.

Azure Functions have an internal behavior that masks this error, and returns a status code 500 instead, along with the following internal error messages, when I configure an Azure Function (tested with both Python and C#, as well as locally and in the cloud) with FUNCTIONS_REQUEST_BODY_SIZE_LIMIT=10:

Microsoft.Azure.WebJobs.Host: Exception binding parameter 'req'. Microsoft.AspNetCore.Server.Kestrel.Core: Request body too large. The max request body size is 10 bytes.

Investigative information

Please provide the following:

  • Timestamp: 10/9/2024, 1:30:44.082 PM
  • Function App version: 4.34.2.2
  • Function App name: -
  • Function name(s) (as appropriate): trigger
  • Invocation ID: 399cedc7-3aa2-4f08-8797-26689bcd9600
  • Region: West Europe

Repro steps

  1. Create a new HTTP-triggered function (either in C# or Python)
  2. Configure FUNCTIONS_REQUEST_BODY_SIZE_LIMIT to a low value, e.g. 10
  3. Execute a request against the HTTP endpoint with a payload larger than 10 bytes

Expected behavior

Azure Functions should return a 413 (and not print an error, as it's an expected condition).

Actual behavior

Azure Functions raise an internal exception and report a 500 to the client.

Known workarounds

I don't know of any workarounds for this.

Related information

  • Programming language used - Python/C#
  • Bindings used - HTTP
@satvu
Copy link
Member

satvu commented Nov 7, 2024

Are you using streaming (python) or ASP.NET Core Integration (C#)? Or older HTTP models?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants