projectkudu / kudu

Kudu is the engine behind git/hg deployments, WebJobs, and various other features in Azure Web Sites. It can also run outside of Azure.
Apache License 2.0
3.12k stars 652 forks source link

Issue with python function app // AzureFunctionApp@2 deployment #3472

Closed dipesh747 closed 1 year ago

dipesh747 commented 1 year ago

I am facing issues when deploying to a function app using task AzureFunctionApp@2 in ADO pipelines. The CICD pipeline has been working perfectly well until the end of last week, at which point all apps using this task started failing.

This is the deployment pipeline: jobs:

The deployment itself is successful, but when I make a call to the function app I get HTTP 500 : Exception while executing function: Functions.http_entry_point Result: Failure Exception: ModuleNotFoundError: No module named 'azure.durable_functions'. Please check the requirements.txt file for the missing module.

azure.durable_functions is inside the requirements.txt (and there is pretty much no other requirements in there) so this indicates it's an issue in the build process.

It seems this deployment mechanism changes WEBSITE_RUN_FROM_PACKAGE to 1 (last week it didn't automatically apply this change and that was set to 0 on the apps using this). I also have SCM_DO_BUILD_DURING_DEPLOYMENT 1 and ENABLE_ORYX_BUILD true

When I set WEBSITE_RUN_FROM_PACKAGE to 0 and reset the function app, if I make another call I get 404 it then struggles with the api routing and eventually the function vanish from the portal. In the app insights logs, I can see the following:

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.).

1 function found 0 functions loaded Initializing function HTTP routes No HTTP routes mapped

This works when using locally in VS code.

Versioning SDK version 4.22.00 Linux python function app python 3.10 I have attached a demo example application which I am trying to deploy app_github_issue.zip

dipesh747 commented 1 year ago

Closing as issue find with Ms Azure pipeline tasks and this has been raised directly on that repo