azure-functions-python-worker icon indicating copy to clipboard operation
azure-functions-python-worker copied to clipboard

[Improvement] Block azure.functions module collided trigger names

Open Hazhzeng opened this issue 5 years ago • 2 comments

Investigative information

Please provide the following:
  • Timestamp: 5/6/2020
  • Function App name: fa-clipy
  • Function name(s) (as appropriate): http
  • Core Tools version:

Repro steps

Provide the steps required to reproduce the problem:
  1. Create a python function app
  2. Create an HTTP trigger with the name "http"
  3. Deploy the function app to a Linux Dedicated app.
  4. Hit /api/http endpoints

Expected behavior

Provide a description of the expected behavior.

The function should go through and execute.

Actual behavior

Provide a description of the actual behavior observed.

The function app throws a 500 (functions not found in azure module) due to a name collision with azure.functions.http module.

Known workarounds

Provide a description of any known workarounds.

Rename trigger name "http" to "httptrigger"

Contents of the requirements.txt file:

Provide the requirements.txt file to help us find out module related issues.

azure-functions

Related information

Provide any related information
  • Links to source
  • Bindings used

Hazhzeng avatar May 06 '20 17:05 Hazhzeng

cc: @divyagandhii

Hazhzeng avatar May 06 '20 17:05 Hazhzeng

Stack Trace:

Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException : Result: Failure Exception: 
AttributeError: module 'azure.functions' has no attribute 'HttpRequest' Stack:
File '/azure-functions-host/workers/python/3.7/LINUX/X64/azure_functions_worker/dispatcher.py', line 309, in _handle__function_load_request func_request.metadata.entry_point)
File '/azure-functions-host/workers/python/3.7/LINUX/X64/azure_functions_worker/utils/wrappers.py', line 40, in call return func(*args, **kwargs)
File '/azure-functions-host/workers/python/3.7/LINUX/X64/azure_functions_worker/loader.py', line 83, in load_function mod = importlib.import_module(fullmodname)
File '/usr/local/lib/python3.7/importlib/__init__.py', line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level)
File '<frozen importlib._bootstrap>', line 1006, in _gcd_import
File '<frozen importlib._bootstrap>', line 983, in _find_and_load
File '<frozen importlib._bootstrap>', line 967, in _find_and_load_unlocked
File '<frozen importlib._bootstrap>', line 677, in _load_unlocked
File '<frozen importlib._bootstrap_external>', line 728, in exec_module
File '<frozen importlib._bootstrap>', line 219, in _call_with_frames_removed
File '/home/site/wwwroot/http/__init__.py', line 1, in <module> import azure.functions as func
File '/azure-functions-host/workers/python/3.7/LINUX/X64/azure/functions/__init__.py', line 8, in <module> from ._http import HttpRequest
File '/azure-functions-host/workers/python/3.7/LINUX/X64/azure/functions/_http.py', line 12, in <module> from ._thirdparty.werkzeug import datastructures as _wk_datastructures
File '/azure-functions-host/workers/python/3.7/LINUX/X64/azure/functions/_thirdparty/werkzeug/datastructures.py', line 2836, in <module> from . import exceptions
File '/azure-functions-host/workers/python/3.7/LINUX/X64/azure/functions/_thirdparty/werkzeug/exceptions.py', line 762, in <module> from .http import HTTP_STATUS_CODES
File '/azure-functions-host/workers/python/3.7/LINUX/X64/azure/functions/_thirdparty/werkzeug/http.py', line 46, in <module> from urllib.request import parse_http_list as _parse_list_header
File '/usr/local/lib/python3.7/urllib/request.py', line 88, in <module> import http.client
File '/home/site/wwwroot/http/__init__.py', line 3, in <module> def main(req: func.HttpRequest ) -> func.HttpResponse: 

Hazhzeng avatar Aug 12 '21 17:08 Hazhzeng