I'm following the documentation below to create a basic function using the CLI
https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-cli-python?tabs=windows%2Cbash%2Cazure-cli%2Cbrowser
When starting function app from the documentation example, I'm seeing the following error
[2024-06-25T12:12:35.599Z] File "/afh/projects/abhijeet-project/azure-functions/demo/function_app.py", line 8, in <module>
[2024-06-25T12:12:35.599Z] @app.route(route="HttpExample", auth_level=func.AuthLevel.Anonymous)
[2024-06-25T12:12:35.599Z] File "/usr/local/lib/python3.10/enum.py", line 437, in __getattr__
[2024-06-25T12:12:35.599Z] raise AttributeError(name) from None
[2024-06-25T12:12:35.599Z] .
[2024-06-25T12:12:36.846Z] 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.).
Can anyone guide how to fix this error? I have not made any changes to the artifacts crated when invoking a function app project. I'm running this code on compute instance created in azure ai studio. TIA.
Here is the full log
vscode ➜ .../code/azure-functions/demo $ func start
Found Python version 3.10.13 (python3).
Azure Functions Core Tools
Core Tools Version: 4.0.5801 Commit hash: N/A +5ac2f09758b98257e728dd1b5576ce5ea9ef68ff (64-bit)
Function Runtime Version: 4.34.1.22669
[2024-06-25T12:12:35.594Z] Worker failed to index functions
[2024-06-25T12:12:35.596Z] Result: Failure
[2024-06-25T12:12:35.596Z] Exception: AttributeError: Anonymous
[2024-06-25T12:12:35.597Z] Stack: File "/usr/lib/azure-functions-core-tools-4/workers/python/3.10/LINUX/X64/azure_functions_worker/dispatcher.py", line 413, in _handle__functions_metadata_request
[2024-06-25T12:12:35.597Z] self.load_function_metadata(
[2024-06-25T12:12:35.597Z] File "/usr/lib/azure-functions-core-tools-4/workers/python/3.10/LINUX/X64/azure_functions_worker/dispatcher.py", line 393, in load_function_metadata
[2024-06-25T12:12:35.597Z] self.index_functions(function_path, function_app_directory)) \
[2024-06-25T12:12:35.597Z] File "/usr/lib/azure-functions-core-tools-4/workers/python/3.10/LINUX/X64/azure_functions_worker/dispatcher.py", line 765, in index_functions
[2024-06-25T12:12:35.597Z] indexed_functions = loader.index_function_app(function_path)
[2024-06-25T12:12:35.597Z] File "/usr/lib/azure-functions-core-tools-4/workers/python/3.10/LINUX/X64/azure_functions_worker/utils/wrappers.py", line 44, in call
[2024-06-25T12:12:35.597Z] return func(*args, **kwargs)
[2024-06-25T12:12:35.597Z] File "/usr/lib/azure-functions-core-tools-4/workers/python/3.10/LINUX/X64/azure_functions_worker/loader.py", line 238, in index_function_app
[2024-06-25T12:12:35.597Z] imported_module = importlib.import_module(module_name)
[2024-06-25T12:12:35.598Z] File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
[2024-06-25T12:12:35.598Z] return _bootstrap._gcd_import(name[level:], package, level)
[2024-06-25T12:12:35.598Z] File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
[2024-06-25T12:12:35.598Z] File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
[2024-06-25T12:12:35.598Z] File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
[2024-06-25T12:12:35.598Z] File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
[2024-06-25T12:12:35.598Z] File "<frozen importlib._bootstrap_external>", line 883, in exec_module
[2024-06-25T12:12:35.598Z] File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
[2024-06-25T12:12:35.599Z] File "/afh/projects/abhijeet-project/code/azure-functions/demo/function_app.py", line 8, in <module>
[2024-06-25T12:12:35.599Z] @app.route(route="HttpExample", auth_level=func.AuthLevel.Anonymous)
[2024-06-25T12:12:35.599Z] File "/usr/local/lib/python3.10/enum.py", line 437, in __getattr__
[2024-06-25T12:12:35.599Z] raise AttributeError(name) from None
[2024-06-25T12:12:35.599Z] .
[2024-06-25T12:12:36.846Z] 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.).
For detailed output, run func with --verbose flag.
[2024-06-25T12:12:41.718Z] Host lock lease acquired by instance ID '000000000000000000000000E2AC0C59'.