Hi Everyone,
I'm working on a FAST- API application with an HTTP trigger on Azure Functions, when I try to deploy I get the error No HTTP Triggers, But it works when I test locally in the terminal
I followed the: https://learn.microsoft.com/en-us/samples/azure-samples/fastapi-on-azure-functions/fastapi-on-azure-functions/
Kindly help me, how can I resolve this, I have given below details of the steps I took. Thanks a Million in advance for some of your valuable suggestions.
Best, Roopesh
This issue is for a: (Azure Functions HTTP Trigger on the Fast API Wrapper )
i have used the code :
import azure.functions as func
from WrapperFunction import app as fastapi_app
app = func.AsgiFunctionApp(app=fastapi_app, http_auth_level=func.AuthLevel.ANONYMOUS)
Also, I have written the wrapper function init.py
When I run the 'func host start' in the terminal, I get the following links, with this I used Postman to check the working, and I found this works very well.
(Python3_9) (base) roopeshbharatwajkr@Roopeshs-MacBook-Pro backend_dli_final % func host start
Found Python version 3.9.18 (python3).
Azure Functions Core Tools
Core Tools Version: 4.0.5455 Commit hash: N/A (64-bit)
Function Runtime Version: 4.27.5.21554
[2024-10-21T08:23:17.773Z] Customer packages not in sys path. This should never happen!
[2024-10-21T08:23:21.531Z] Worker process started and initialized.
Functions:
http_app_func: [GET,POST,DELETE,HEAD,PATCH,PUT,OPTIONS] http://localhost:7071//{*route}
For detailed output, run func with --verbose flag.
Host.json file
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[2.*, 3.0.0)"
},
"extensions":
{
"http":
{
"routePrefix": ""
}
}
}
When I Deploy the function app, I get the following in the Output tab of Vs-code
11:31:47 dli-function-app: Command: oryx build /tmp/zipdeploy/extracted -o /tmp/build/expressbuild --platform python --platform-version 3.10.4 -i /tmp/8dcf1bb8f91b1b9 -p packagedir=.python_packages/lib/site-packages
11:32:00 dli-function-app: Syncing triggers...
11:32:03 dli-function-app: Querying triggers...
11:32:04 dli-function-app: No HTTP triggers found.
When i checked the Diagnose and Solve Problem within the Azure function,
- I checked the specific issue regarding :-> 'Functions not triggering'.
- I found that,
Exception: Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException:
Message : Worker failed to index functions
Result: Failure Exception: ModuleNotFoundError: No module named 'uvicorn'. Cannot find module. Please check the requirements.txt file for the missing module. For more info, please refer the troubleshooting guide: https://aka.ms/functions-modulenotfound. Current sys.path: ['/home/site/wwwroot', '/home/site/wwwroot/.python_packages/lib/site-packages', '/azure-functions-host/workers/python/3.10/LINUX/X64', '/usr/local/lib/python310.zip', '/usr/local/lib/python3.10', '/usr/local/lib/python3.10/lib-dynload', '/usr/local/lib/python3.10/site-packages'] Stack: File '/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/dispatcher.py', line 469, in _handle__functions_metadata_request self.load_function_metadata( File '/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/dispatcher.py', line 449, in load_function_metadata self.index_functions(function_path, function_app_directory)) \ File '/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/dispatcher.py', line 822, in index_functions indexed_functions = loader.index_function_app(function_path) File '/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/utils/wrappers.py', line 49, in call raise extend_exception_message(e, message) File '/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/utils/wrappers.py', line 44, in call return func(*args, **kwargs) File '/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/loader.py', line 244, in index_function_app imported_module = importlib.import_module(module_name) File '/usr/local/lib/python3.10/importlib/init.py', line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File '/home/site/wwwroot/function_app.py', line 3, in from backend_dli import app as fastapi_app File '/home/site/wwwroot/backend_dli/init.py', line 3, in import uvicorn
Exception : ERROR: Error: No module named 'uvicorn', Cannot find module. Pl |
Exception : ERROR: Error: No module named 'uvicorn', Cannot find module. Pl Message : ERROR: Error: No module named 'uvicorn', Cannot find module. Please check the requirements.txt file for the missing module. For more info, please refer the troubleshooting guide: https://aka.ms/functions-modulenotfound. Current sys.path: ['/home/site/wwwroot', '/home/site/wwwroot/.python_packages/lib/site-packages', '/azure-functions-host/workers/python/3.10/LINUX/X64', '/usr/local/lib/python310.zip', '/usr/local/lib/python3.10', '/usr/local/lib/python3.10/lib-dynload', '/usr/local/lib/python3.10/site-packages'] I found that there is no Module named Uvicorn, actually i don't use the same for the Fast API so , i have removed it but still i get this error. even after removing the import statement and removing in the Req.txt file. |