Open yonahcitron opened 3 months ago
Tagging @shreyabatra4 to route the issue to the appropriate team.
Same here @4.0.6280, lost 2h today during a lesson with students.
FYI: official docs shows WRONG command https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-cli-python?tabs=linux%2Cbash%2Cazure-cli%2Cbrowser#create-a-local-function
Same here, lost a couple of hours and figured out by comparing painfully and step by step. Please do also fix the docs.
Version
4.0.5907
Description
Problem
Create a new python function app, and add an http trigger template passing
--authlevel anonymous
or--authlevel ANONYMOUS
.This template generates the incorrect auth_level constant in the decorator:
@app.route(route="MyHttpFunction", auth_level=func.AuthLevel.Anonymous)
It should be upper-case:
@app.route(route="MyHttpFunction", auth_level=func.AuthLevel.ANONYMOUS)
When you run the buggy template, it will give you:
[2024-07-30T13:23:33.803Z] Exception: AttributeError: Anonymous
NOTE
This bug only occurs when passing the parameters explicitly.
If you run it without the flag, i.e.:
func new --template "HTTP trigger" --name MyHttpFunction
It will prompt you:
And the resulting generated template will have the correct constant value.
Steps to reproduce
Code to Execute
Exception Stack Trace