3. Execute using `func host start` (or press F5)
### Expected behavior
`blobname` is provided and according to
https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-blob-trigger?tabs=python-v2%2Cisolated-process%2Cnodejs-v4&pivots=programming-language-python
the [blob name pattern](https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-blob-trigger?tabs=python-v2%2Cisolated-process%2Cnodejs-v4&pivots=programming-language-python#blob-name-patterns) may be used.
### Actual behavior
if `blobname` parameter is in function set will trigger the following exception:
[2023-11-06T00:50:02.101Z] Worker failed to index functions
[2023-11-06T00:50:02.104Z] Result: Failure
Exception: FunctionLoadError: cannot load the blob_trigger function: the following parameters are declared in Python but not in function.json: {'blobname', 'myblob'} {'myblob'}
Stack: File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.11/WINDOWS/X64\azure_functions_worker\dispatcher.py", line 338, in _handle__functions_metadata_request
fx_metadata_results = self.index_functions(function_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.11/WINDOWS/X64\azure_functions_worker\dispatcher.py", line 624, in index_functions
fx_metadata_results = loader.process_indexed_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.11/WINDOWS/X64\azure_functions_worker\loader.py", line 67, in process_indexed_function
function_info = functions_registry.add_indexed_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.11/WINDOWS/X64\azure_functions_worker\functions.py", line 409, in add_indexed_function
input_types, output_types = self.validate_function_params(params,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.11/WINDOWS/X64\azure_functions_worker\functions.py", line 139, in validate_function_params
raise FunctionLoadError(
.
if `blobname` parameter is NOT set in function it will trigger the following exception:
[2023-11-06T00:51:12.756Z] Executed 'Functions.blob_trigger' (Failed, Id=1dafbe3f-7bb8-41c3-a8c0-881fb385acb7, Duration=15ms)
[2023-11-06T00:51:12.757Z] System.Private.CoreLib: Exception while executing function: Functions.blob_trigger. System.Private.CoreLib: Result: Failure
Exception: NameError: name 'blobname' is not defined
Stack: File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.11/WINDOWS/X64\azure_functions_worker\dispatcher.py", line 479, in _handle__invocation_request
call_result = await self._loop.run_in_executor(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.11/WINDOWS/X64\azure_functions_worker\dispatcher.py", line 752, in _run_sync_func
return ExtensionManager.get_sync_invocation_wrapper(context,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.11/WINDOWS/X64\azure_functions_worker\extension.py", line 215, in _raw_invocation_wrapper
result = function(args)
^^^^^^^^^^^^^^^^
File "C:\Users\user\Projects\azure\faas_imageresize\function_app.py", line 12, in blob_trigger
print(blobname)
^^^^^^^^
It is a catch-22: If parameter in function is set, it will won't start. If parameter is set, it starts, but if a blob triggers the function it will raise an exception and fail.
### Known workarounds
not tested, but: probably use v1
### Contents of the requirements.txt file:
Investigative information
Repro steps
app = func.FunctionApp()
@app.blob_trigger(arg_name="myblob", path="mycontainer/input/{blobname}.jpg", connection="AzureWebJobsStorage") def blob_trigger(myblob: func.InputStream, blobname): logging.info(blobname)
[2023-11-06T00:50:02.101Z] Worker failed to index functions [2023-11-06T00:50:02.104Z] Result: Failure Exception: FunctionLoadError: cannot load the blob_trigger function: the following parameters are declared in Python but not in function.json: {'blobname', 'myblob'} {'myblob'} Stack: File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.11/WINDOWS/X64\azure_functions_worker\dispatcher.py", line 338, in _handle__functions_metadata_request fx_metadata_results = self.index_functions(function_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.11/WINDOWS/X64\azure_functions_worker\dispatcher.py", line 624, in index_functions fx_metadata_results = loader.process_indexed_function( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.11/WINDOWS/X64\azure_functions_worker\loader.py", line 67, in process_indexed_function function_info = functions_registry.add_indexed_function( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.11/WINDOWS/X64\azure_functions_worker\functions.py", line 409, in add_indexed_function input_types, output_types = self.validate_function_params(params, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.11/WINDOWS/X64\azure_functions_worker\functions.py", line 139, in validate_function_params
raise FunctionLoadError( .
[2023-11-06T00:51:12.756Z] Executed 'Functions.blob_trigger' (Failed, Id=1dafbe3f-7bb8-41c3-a8c0-881fb385acb7, Duration=15ms) [2023-11-06T00:51:12.757Z] System.Private.CoreLib: Exception while executing function: Functions.blob_trigger. System.Private.CoreLib: Result: Failure Exception: NameError: name 'blobname' is not defined Stack: File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.11/WINDOWS/X64\azure_functions_worker\dispatcher.py", line 479, in _handle__invocation_request call_result = await self._loop.run_in_executor( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\concurrent\futures\thread.py", line 58, in run result = self.fn(*self.args, self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.11/WINDOWS/X64\azure_functions_worker\dispatcher.py", line 752, in _run_sync_func return ExtensionManager.get_sync_invocation_wrapper(context, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.11/WINDOWS/X64\azure_functions_worker\extension.py", line 215, in _raw_invocation_wrapper
result = function(args) ^^^^^^^^^^^^^^^^ File "C:\Users\user\Projects\azure\faas_imageresize\function_app.py", line 12, in blob_trigger print(blobname) ^^^^^^^^
azure-functions