Azure Function POST with payload larger than roughly 100 KB return a 400/403 error.

Michael Polonskiy 0 Reputation points
2024-06-27T07:19:07.12+00:00

I have the following scenario: We are running an Azure Function on Linux operating system and a P0v3 service plan. Runtime version 4.34.2.2.

We are sending a https POST request as content type application/json to this Azure Function which contains a json body with a base64 encoded payload. If the payload is small, several KB, all works well the function runs as expected and we receive a 200 response. However if the body exceeds 100 KB we get a 400 or 403 error in return, this varies sometimes. This behaviour can be observed from all endpoint systems/ networks or softwares used. The only main difference noted is that when you run the azure function directly from the azure portal with test/run by copying the payload into the body window the function gets triggered and is correctly executed. Thus we know for smaller payloads everything works fine, however for payloads above 100 KB there seems to be a border we dont see any logging and it appears the function does not even get triggered. Things tried so far:

I created a python function which increases the payload size step by step and sets the api call. The result is that the limit is between 104 and 106 KB.

It does not matter if the body is a valid json or just simply text. As soon as we are above 106 kb the 400 or 403 error gets thrown.

Changing network, machine or software does not change anything it is the same result in all scenarios.

The only main difference noted is that when you run the azure function directly from the azure portal with test/run by copying the payload into the body window the function gets triggered and is correctly executed.

The environment variable FUNCTIONS_REQUEST_BODY_SIZE_LIMIT iss set to 100000000 in azure portal browser and in the local settings.json.

The host.json looks like this regarding variables and sizes:

User's image

Only link found so far which references same behaviour: https://github.com/Azure/azure-functions-python-worker/issues/1198

Any help or insights on this would be greatly appreciated.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,646 questions
0 comments No comments
{count} votes