Is your question related to a specific version? If so, please specify:
azure-functions==1.23.0
What binding does your question apply to, if any? (e.g. Blob Trigger, Event Hub Binding, etc)
It relates to azure.functions.decorators.function_app.FunctionRegister class, to be precise to its method get_functions
Question
Hello!
I recently found that azure.functions.decorators.function_app.FunctionRegister.get_functions method, if invoked twice, throws an error like "ValueError: Function DummyFunctionName does not have a unique function name. Please change @app.function_name() or the function method name to be unique.", even if function is truly unique. This happens because "validate_function_names" internally populates "functions_bindings", but doesn't cleanup before or after populating, therefore on second run it throws error that function name is not unique
def validate_function_names(self, functions: List[Function]):
if not self.functions_bindings:
self.functions_bindings = {} # HERE, but only if originally None
for function in functions:
function_name = function.get_function_name()
if function_name in self.functions_bindings:
raise ValueError(
f"Function {function_name} does not have a unique"
f" function name. Please change @app.function_name() or"
f" the function method name to be unique.")
self.functions_bindings[function_name] = True
and it looks like it supposed to be like
def validate_function_names(self, functions: List[Function]):
functions_bindings = {} # HERE: list of already checked functions creates every time on invocation
for function in functions:
function_name = function.get_function_name()
if function_name in functions_bindings:
raise ValueError(
f"Function {function_name} does not have a unique"
f" function name. Please change @app.function_name() or"
f" the function method name to be unique.")
self.functions_bindings[function_name] = True # NOTE: lookup remains same
However, I'm a bit confused if it is actual bug, and, if yes, how and where I can create PR to fix it?
Thank you!
Is your question related to a specific version? If so, please specify:
azure-functions==1.23.0
What binding does your question apply to, if any? (e.g. Blob Trigger, Event Hub Binding, etc)
It relates to
azure.functions.decorators.function_app.FunctionRegisterclass, to be precise to its methodget_functionsQuestion
Hello!
I recently found that
azure.functions.decorators.function_app.FunctionRegister.get_functionsmethod, if invoked twice, throws an error like "ValueError: Function DummyFunctionName does not have a unique function name. Please change @app.function_name() or the function method name to be unique.", even if function is truly unique. This happens because "validate_function_names" internally populates "functions_bindings", but doesn't cleanup before or after populating, therefore on second run it throws error that function name is not uniqueand it looks like it supposed to be like
However, I'm a bit confused if it is actual bug, and, if yes, how and where I can create PR to fix it?
Thank you!