The 504 Gateway Timeout and 499 errors often occur with Azure Functions when processing larger files due to the default execution timeout limits, network constraints, or resource throttling.
For the Azure Function, you can increase the functionTimeout
value in the host.json
file. The maximum allowed timeout depends on your hosting plan:
- Consumption Plan: Up to 5 minutes by default, extendable to 10 minutes.
- Premium Plan or Dedicated App Service Plan: No maximum limit, so you can set a longer duration if needed.
ADF HTTP activity has its own timeout configuration, so adjust the timeout there as well.
Reading large files all at once may cause issues. Break down the processing into smaller chunks, perhaps reading and writing data in batches, to reduce memory load and processing time per batch.
I recommed using Durable Functions which enable long-running workflows by allowing the function to checkpoint and resume processing, which can help process large files by breaking down the task into smaller steps.