Azure / azure-functions-host

The host/runtime that powers Azure Functions
https://functions.azure.com
MIT License
1.92k stars 441 forks source link

Functions failing to load despite no changes #10463

Closed menksix closed 1 week ago

menksix commented 2 weeks ago

Our azure function app is failing to load any functions, despite us having made no deployments to the function app or any other changes.

We are seeing the following failures in the application insights logs: 9/11/2024, 3:25:46.409 AM No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.). 9/11/2024, 3:25:46.351 AM Generating 0 job function(s)

Contrast this with when the function was observed to be working: 8/30/2024, 1:00:46.876 PM Generating 7 job function(s) 8/30/2024, 1:00:45.797 PM 7 functions loaded

We have observed that the docker image underpinning the function has been automatically updated, around the time of the failure. Perhaps this could be causing some of the issues? ...._docker.log:2024-09-11T03:25:33.987Z INFO - Status: Downloaded newer image for mcr.microsoft.com/azure-functions/dotnet-isolated:4-dotnet-isolated8.0-appservice-stage4 sha256:42d412e6bd84db084a7d40094b3d123d6a24abf4322980271264c483d6870242

bhagyshricompany commented 1 week ago

Thanks for informing will check and update you.Thanks

adukstad commented 1 week ago

Same issue here. 2 out of our 3 environment started failing this weekend. 3 out of 3 once I recreated the working one to verify.

dotnet-isolated / .NET8

menksix commented 1 week ago

Hi @adukstad - we found the root cause in our case. We were using https://github.com/actions/upload-artifact to deploy the function, and it stopped including hidden files by default when switching from v3 to v4 of the action. This meant that the .azurefunctions folder was not being deployed. We suspect this only manifested itself when the underlying docker container was recreated, due to the release of the new docker image by Microsoft. Even if you're not using this action to deploy your files, I would check if all hidden files are being included as a first step.

adukstad commented 1 week ago

Hi @adukstad - we found the root cause in our case. We were using https://github.com/actions/upload-artifact to deploy the function, and it stopped including hidden files by default when switching from v3 to v4 of the action. This meant that the .azurefunctions folder was not being deployed. We suspect this only manifested itself when the underlying docker container was recreated, due to the release of the new docker image by Microsoft. Even if you're not using this action to deploy your files, I would check if all hidden files are being included as a first step.

Thank you, I am in fact using the same action, will verify now !

adukstad commented 1 week ago

@menksix Thank you, that worked like a charm !

For others facing the same issue, you now need to explicitly include hidden files

- name: "Upload functions"
  uses: actions/upload-artifact@v4
  with:
    name: functions
    path: ${{ github.workspace }}/out/functions/**
    include-hidden-files: true # <------
bhagyshricompany commented 1 week ago

Hope its working @menksix .if anything need more please share. else we can close.Thanks

fabiocav commented 1 week ago

Thank you for the update here folks. Will close this as resolved, but please let us know if you have any additional questions.