I'm using a timer triggered azure function in .NET.
Azure function info:
runtime version: 4.29.1.21919
file system: windows
.NET version: .NET6.0
I have a static json file which is published to the azure function runtime environment. It is placed in the root of the project and I use the following code to get its path:
Path.Combine(context.FunctionAppDirectory, 'myconfig.json')
The weird thing is that the azure function occasionally throws FileNotFound
error on this file. Sometimes the azure function can read the file and sometimes it can't, without any code or azure function configuration change.
Does anyone have any idea about why this happens?
---Update on 2024-02-26:
BTW, I'm using the Azure function hosted in Premium Plan.
I used the same way to read configuration file in other azure functions hosted in Consumption Plan and such error doesn't happen ever.
So I suspect the premium plan is the one to blame. But because my azure function requires ~3GB RAM and the Consumption Plan has 1.5 GB memory limit so I have to choose the Premium Plan.