I have a Function App (Python) that should read from Container1 in Blob Storage, and then write something back to Container2. Both containers are in the same Storage Account and subject to the same permissions.
When I run the Function locally, with Azure Functions Core Tools, everything works fine. When I run upload the Function to Azure and run it from there, it successfully reads from the Blob, but does not write to it. Given the code works locally, I think the Function App code is ok, so it must be a discrepancy between my local environment and what’s in Azure, but cannot work out what.
I’ve checked everything I can think of. I’ve recreated everything from scratch in a new Resource Group and get the same problem. There are no error messages that I can see.
I’ve got AppInsights running, but not seeing anything in there.
Has anyone had a similar issue or have any ideas of what to check?
2
Answers
Found the problem. I hadn't realised that Function Apps in the consumption plan automatically time out after 5 mins. This is not enforced in Azure Function Core Tools.
As my Function uploads a file to another service, then waits 5 mins before checking the output, it was always going to time out.
The fix was to set the timeout value in host.json to a more suitable value. I went for 10 mins which is the max for the consumption plan (as per this site).
I have reproduced in my environment and got expected results as below:
Below is the code which worked for me:
init.py:
local.settings.json:
Then successfully executed locally:
Then Deployed it:
Blob Uploaded:
Even After deploying the function is copying data to destination container and it worked as expected:
Note: Also check if the connection is right as below:
Output:
Blob copied to destination container: