Azure function app using FUNCTIONS_REQUEST_BODY_SIZE_LIMIT not working on "warmup"
Hello,
we have a problem with our Azure Function App (Consumption).
We want to upload larger files, so we set up an environment variable: FUNCTIONS_REQUEST_BODY_SIZE_LIMIT with value 524288000.
This works fine.
Until our app goes to sleep:
2025-02-11T14:30:40Z [Information] DrainMode mode enabled
2025-02-11T14:30:40Z [Information] Calling StopAsync on the registered listeners
2025-02-11T14:30:40Z [Information] Call to StopAsync complete, registered listeners are now stopped
because after that the first big upload will fail.
It seem like that the environment variable is not setup yet - because i get following exception:
Exception while executing function: Functions.upload Exception binding parameter 'req' Request body too large. The max request body size is 104857600 bytes.
and the clients (tested with postman and httpclient) get 500 as response.
In LogStream i see nothing new so the call must be answered / filtered out before the call of our function.
In Application Insights i can see:
2/11/2025, 3:22:25 PM -
ConcurrencyOptions { "DynamicConcurrencyEnabled": false, "MaximumFunctionConcurrency": 500, "CPUThreshold": 0.8, "SnapshotPersistenceEnabled": true }
Severity level:
2/11/2025, 3:22:25 PM -
HttpOptions { "DynamicThrottlesEnabled": false, "EnableChunkedRequestBinding": false, "MaxConcurrentRequests": -1, "MaxOutstandingRequests": -1, "RoutePrefix": "api" }
Severity level:
2/11/2025, 3:22:00 PM -
Host lock lease acquired by instance ID '00000000000000000000000040F8C73E'.
Severity level:
2/11/2025, 3:21:55 PM -
Exception while executing function: Functions.upload
Problem Id:
2/11/2025, 3:21:55 PM -
Executed 'Functions.upload' (Failed, Id=768b05e5-0f36-4e0e-8e27-7cbbe13354f1, Duration=16ms)
Severity level:
2/11/2025, 3:21:55 PM -
Exception while executing function: Functions.upload
Problem Id:
2/11/2025, 3:21:55 PM -
Executing 'Functions.upload' (Reason='This function was programmatically called via the host APIs.', Id=768b05e5-0f36-4e0e-8e27-7cbbe13354f1)
Severity level:
2/11/2025, 3:21:55 PM -
Job host started
Severity level:
2/11/2025, 3:21:55 PM -
Host started (261ms)
Severity level:
2/11/2025, 3:21:55 PM -
The next 5 occurrences of the 'Cleanup' schedule (Cron: '0 0 0 * * *') will be: 02/12/2025 00:00:00Z 02/13/2025 00:00:00Z 02/14/2025 00:00:00Z 02/15/2025 00:00:00Z 02/16/2025 00:00:00Z
Severity level:
2/11/2025, 3:21:55 PM -
Host initialized (133ms)
Severity level:
2/11/2025, 3:21:55 PM -
Initializing function HTTP routes Mapped function route 'api/config' [all] to 'config' Mapped function route 'api/v1/download' [get] to 'download' Mapped function route 'api/oauth2-redirect.html' [GET] to 'RenderOAuth2Redirect' Mapped function route 'api/openapi/{version}.{extension}' [GET] to 'RenderOpenApiDocument' Mapped function route 'api/swagger.{extension}' [GET] to 'RenderSwaggerDocument' Mapped function route 'api/swagger/ui' [GET] to 'RenderSwaggerUI' Mapped function route 'api/v1/upload' [post] to 'upload' Mapped function route 'api/version' [all] to 'version'
Severity level:
2/11/2025, 3:21:55 PM -
HttpOptions { "DynamicThrottlesEnabled": false, "EnableChunkedRequestBinding": false, "MaxConcurrentRequests": -1, "MaxOutstandingRequests": -1, "RoutePrefix": "api" }
Severity level:
2/11/2025, 3:21:55 PM -
Found the following functions: Host.Functions.Cleanup Host.Functions.config Host.Functions.download Host.Functions.RenderOAuth2Redirect Host.Functions.RenderOpenApiDocument Host.Functions.RenderSwaggerDocument Host.Functions.RenderSwaggerUI Host.Functions.upload Host.Functions.version
Severity level:
2/11/2025, 3:21:55 PM -
Worker process started and initialized.
Severity level:
2/11/2025, 3:21:55 PM -
Generating 9 job function(s)
Severity level:
2/11/2025, 3:21:55 PM -
Starting Host (HostId=XXX, InstanceId=YYY, Version=4.1036.3.3, ProcessId=65, AppDomainId=1, InDebugMode=True, InDiagnosticMode=False, FunctionsExtensionVersion=~4)
Severity level:
2/11/2025, 3:21:55 PM -
Starting JobHost
Severity level:
2/11/2025, 3:21:55 PM -
ScaleOptions { "ScaleMetricsMaxAge": "00:02:00", "ScaleMetricsSampleInterval": "00:00:10", "MetricsPurgeEnabled": true, "IsTargetScalingEnabled": true, "IsRuntimeScalingEnabled": false }
Severity level:
2/11/2025, 3:21:55 PM -
SingletonOptions { "LockPeriod": "00:00:15", "ListenerLockPeriod": "00:01:00", "LockAcquisitionTimeout": "10675199.02:48:05.4775807", "LockAcquisitionPollingInterval": "00:00:05", "ListenerLockRecoveryPollingInterval": "00:01:00" }
Severity level:
2/11/2025, 3:21:55 PM -
ConcurrencyOptions { "DynamicConcurrencyEnabled": false, "MaximumFunctionConcurrency": 500, "CPUThreshold": 0.8, "SnapshotPersistenceEnabled": true }
Severity level:
2/11/2025, 3:21:55 PM -
FunctionResultAggregatorOptions { "BatchSize": 1000, "FlushTimeout": "00:00:30", "IsEnabled": true }
Severity level:
2/11/2025, 3:21:55 PM -
LanguageWorkerOptions { "WorkerConfigs": [ { "Description": { "Language": "dotnet-isolated", "DefaultRuntimeName": null, "DefaultRuntimeVersion": "8.0", "SupportedArchitectures": null, "SupportedOperatingSystems": null, "SupportedRuntimeVersions": null, "SanitizeRuntimeVersionRegex": null, "WorkerIndexing": "true", "Extensions": [ ".dll" ], "UseStdErrorStreamForErrorsOnly": false, "DefaultExecutablePath": "dotnet", "DefaultWorkerPath": "/home/site/wwwroot/abc.dll", "WorkerDirectory": "/home/site/wwwroot", "Arguments": [], "WorkerArguments": null, "IsDisabled": null }, "Arguments": { "ExecutablePath": "dotnet", "ExecutableArguments": [], "WorkerPath": "/home/site/wwwroot/CloudExchangeBackend.dll", "WorkerArguments": [] }, "CountOptions": { "SetProcessCountToNumberOfCpuCores": false, "ProcessCount": 1, "MaxProcessCount": 10, "ProcessStartupInterval": "00:00:10", "ProcessStartupTimeout": "00:01:00", "InitializationTimeout": "00:00:10", "EnvironmentReloadTimeout": "00:00:30", "ProcessRestartInterval": "00:00:10", "ProcessShutdownTimeout": "00:00:10" } } ] }
Severity level:
2/11/2025, 3:21:55 PM -
LoggerFilterOptions { "MinLevel": "None", "Rules": [ { "ProviderName": null, "CategoryName": null, "LogLevel": "Warning", "Filter": null }, { "ProviderName": null, "CategoryName": null, "LogLevel": null, "Filter": "<AddFilter>b__0" }, { "ProviderName": "Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.WebHostSystemLoggerProvider", "CategoryName": null, "LogLevel": "None", "Filter": null }, { "ProviderName": "Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.WebHostSystemLoggerProvider", "CategoryName": null, "LogLevel": null, "Filter": "<AddFilter>b__0" }, { "ProviderName": null, "CategoryName": null, "LogLevel": null, "Filter": "<AddFilter>b__0" }, { "ProviderName": "Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.SystemLoggerProvider", "CategoryName": null, "LogLevel": "None", "Filter": null }, { "ProviderName": "Microsoft.Azure.WebJobs.Script.WebHost.Diagnostics.SystemLoggerProvider", "CategoryName": null, "LogLevel": null, "Filter": "<AddFilter>b__0" } ] }
Severity level:
2/11/2025, 3:21:55 PM -
ApplicationInsightsLoggerOptions { "SamplingSettings": { "EvaluationInterval": "00:00:15", "InitialSamplingPercentage": 100.0, "MaxSamplingPercentage": 100.0, "MaxTelemetryItemsPerSecond": 20.0, "MinSamplingPercentage": 0.1, "MovingAverageRatio": 0.25, "SamplingPercentageDecreaseTimeout": "00:02:00", "SamplingPercentageIncreaseTimeout": "00:15:00" }, "SamplingExcludedTypes": "Request", "SamplingIncludedTypes": null, "SnapshotConfiguration": null, "EnablePerformanceCountersCollection": true, "HttpAutoCollectionOptions": { "EnableHttpTriggerExtendedInfoCollection": true, "EnableW3CDistributedTracing": true, "EnableResponseHeaderInjection": true }, "LiveMetricsInitializationDelay": "00:00:15", "EnableLiveMetrics": true, "EnableLiveMetricsFilters": true, "EnableQueryStringTracing": false, "EnableDependencyTracking": true, "DependencyTrackingOptions": null, "TokenCredentialOptions": null, "DiagnosticsEventListenerLogLevel": null, "EnableAutocollectedMetricsExtractor": false, "EnableMetricsCustomDimensionOptimization": false }
Severity level:
2/11/2025, 3:21:55 PM -
9 functions loaded
Severity level:
2/11/2025, 3:21:55 PM -
0 functions found (Custom)
Severity level:
2/11/2025, 3:21:55 PM -
Reading functions metadata (Custom)
Severity level:
2/11/2025, 3:21:55 PM -
Loading functions metadata
Severity level:
2/11/2025, 3:21:55 PM -
Host initialization: ConsecutiveErrors=0, StartupCount=3, OperationId=ZZZ
Severity level:
2/11/2025, 3:21:55 PM -
Initializing Host. OperationId: 'ZZZ'.
Severity level:
2/11/2025, 3:21:55 PM -
Initializing Warmup Extension.
Severity level:
2/11/2025, 3:21:55 PM -
Skipping WorkerConfig for stack: dotnet-isolated since it is disabled.
Severity level:
2/11/2025, 3:21:55 PM -
Skipping WorkerConfig for stack: dotnet-isolated since it is disabled.
Severity level:
2/11/2025, 3:21:54 PM -
Storing keys in a directory '/home/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed. For more information go to https://aka.ms/aspnet/dataprotectionwarning
Severity level:
2/11/2025, 3:21:45 PM -
upload
URL:
The error does not occur when we are using "App Service" Hosting Plan for our Azure Function.
Please help us - copilot was not able to give us an solution ;-)