For the first time, I'm trying to develop an HTTP triggered Azure Function via VS Code. I do not altered the initial function code, it is as it was created and nothing more. I followed the Microsoft doc for this subject and I thaught I did it the same way but the function doesn't work so I can easily guess I'm wrong.
I installed VS Code extensions (Azure Tools), Azure Function Core Tools, I even tryied to reinstall Python 3.10.11 version. Normally, I have all the files required :
host.json params :
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.*, 4.0.0)"
}
}
local.settings.json params :
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "connection_string",
"FUNCTIONS_WORKER_RUNTIME": "python"
}
}
function.json params :
{
"scriptFile": "__init__.py",
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"get",
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "$return"
}
]
}
When I try "Execute Function Now", I get this as an output :
10:35:24: Error: Failed to connect. Make sure your project is running locally.
When I debug it, I get this :
Found Python version 3.10.11 (py).
Azure Functions Core Tools
Core Tools Version: 4.0.5198 Commit hash: N/A (64-bit)
Function Runtime Version: 4.21.1.20667
Functions:
MyFirstAzureFunction: \[GET,POST\] http://localhost:7071/api/MyFirstAzureFunction
[2023-06-09T07:22:24.140Z] 2.18s - Could not connect to 127.0.0.1: 53444
[2023-06-09T07:22:24.144Z] Traceback (most recent call last):
[2023-06-09T07:22:24.146Z] File "c:.\.vscode\extensions\ms-python.python-2023.10.0\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 493, in start_client
[2023-06-09T07:22:24.147Z] s.connect((host, port)) [2023-06-09T07:22:24.149Z] ConnectionRefusedError: [WinError 10061] No connection could be established because the target computer expressly refused it
[2023-06-09T07:22:24.150Z] Could not connect to 127.0.0.1: 53444 ...
[2023-06-09T07:22:24.723Z] PublishSpecializationCompleteEvent failed with System.InvalidOperationException: An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.
[2023-06-09T07:22:24.724Z] at System.Net.Http.HttpClient.PrepareRequestMessage(HttpRequestMessage request)
[2023-06-09T07:22:24.725Z] at System.Net.Http.HttpClient.CheckRequestBeforeSend(HttpRequestMessage request)
[2023-06-09T07:22:24.725Z] at System.Net.Http.HttpClient.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
[2023-06-09T07:22:24.726Z] at System.Net.Http.HttpClient.SendAsync(HttpRequestMessage request)
[2023-06-09T07:22:24.726Z] at Microsoft.Azure.WebJobs.Script.WebHost.Management.MeshServiceClient.SendAsync(IEnumerable`1 formData) in /_/src/WebJobs.Script.WebHost/Management/MeshServiceClient.cs:line 154
[2023-06-09T07:22:24.727Z] at Microsoft.Azure.WebJobs.Script.WebHost.Management.MeshServiceClient.NotifyHealthEvent(ContainerHealthEventType healthEventType, Type source, String details) in /_/src/WebJobs.Script.WebHost/Management/MeshServiceClient.cs:line 104
[2023-06-09T07:22:24.727Z] at Microsoft.Azure.WebJobs.Script.WebHost.ContainerManagement.LinuxContainerActivityPublisher.PublishSpecializationCompleteEvent() in /\_/src/WebJobs.Script.WebHost/ContainerManagement/LinuxContainerActivityPublisher.cs:line 122
[2023-06-09T07:23:20.598Z] Starting worker process failed
[2023-06-09T07:23:20.600Z] Microsoft.Azure.WebJobs.Script.Grpc: The operation has timed out.
[2023-06-09T07:23:20.623Z] Failed to start a new language worker for runtime: python.
[2023-06-09T07:23:20.780Z] PublishContainerActivity
[2023-06-09T07:23:20.781Z] System.Net.Http: An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.
[2023-06-09T07:23:21.597Z] Failed to publish status to /memoryactivity
[2023-06-09T07:23:21.598Z] System.Private.Uri: Invalid URI: The hostname could not be parsed.
[2023-06-09T07:23:22.749Z] Language Worker Process exited. Pid=10368.
[2023-06-09T07:23:22.750Z] py exited with code -1073741819 (0xC0000005). .
[2023-06-09T07:23:34.664Z] Language Worker Process exited. Pid=2652.
[2023-06-09T07:23:34.667Z] py exited with code -1073741819 (0xC0000005). .\
I tried to connect to the local port 53444 but this also failed. Currently, I do not know what to do and how to fix this.