Exception: AttributeError: Anonymous when starting a basic function app

I’m very new to azure function apps and 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'.

I have tried researching about the problem on number of forums but I did not find any resolution to this particular issue. My thinking is that the error “AttributeError: Anonymous” when starting an Azure Function typically indicates that there’s an issue with the function’s code or configuration. But the thing is, I did not make any changes to the autogenerated artifacts created after I ran func new ... command as instructed in the documentation.

I was hoping func start would spin up a localhost.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật