Azure / azure-functions-python-library

Azure Functions Python SDK
MIT License
146 stars 61 forks source link

Unable to run an Azure Python function in VSCode #210

Open eComPlt opened 3 months ago

eComPlt commented 3 months ago

Please report the issue to Azure/azure-functions-python-worker via the following link: https://github.com/Azure/azure-functions-python-worker/issues/new?assignees=&labels=&template=bug_report.md&title=%5BBUG%5D+Bug+Title I have successfully created Azure Python Function V2, I am able to successfully launch the Azure Function from Terminal by running func host start command. However, when I try to run the Azure Function from VSCode with the Run and Debug option 'Attach To Python Functions' I am getting following error. Looking for guidance to troubleshoot the error.

Executing task: func host start --verbose --port 7072

Found Python version 3.10.12 (python3).

              %%%%%%
             %%%%%%
        @   %%%%%%    @
      @@   %%%%%%      @@
   @@@    %%%%%%%%%%%    @@@
 @@      %%%%%%%%%%        @@
   @@         %%%%       @@
     @@      %%%       @@
       @@    %%      @@
            %%
            %

Azure Functions Core Tools Core Tools Version: 4.0.5530 Commit hash: N/A +c8883e7f3c06e2b424fbac033806c19d8d91418c (64-bit) Function Runtime Version: 4.28.5.21962

[2024-03-26T03:21:08.968Z] Building host: version spec: , startup suppressed: 'False', configuration suppressed: 'False', startup operation id: '333306bc-6c60-4cfb-a72e-7c27d090dc1f' [2024-03-26T03:21:08.975Z] Reading host configuration file '/home/linuxadmin/functest/host.json' [2024-03-26T03:21:08.977Z] Host configuration file read: [2024-03-26T03:21:08.977Z] { [2024-03-26T03:21:08.978Z] "version": "2.0", [2024-03-26T03:21:08.978Z] "logging": { [2024-03-26T03:21:08.978Z] "applicationInsights": { [2024-03-26T03:21:08.978Z] "samplingSettings": { [2024-03-26T03:21:08.978Z] "isEnabled": true, [2024-03-26T03:21:08.978Z] "excludedTypes": "Request" [2024-03-26T03:21:08.978Z] } [2024-03-26T03:21:08.978Z] } [2024-03-26T03:21:08.979Z] }, [2024-03-26T03:21:08.979Z] "extensionBundle": { [2024-03-26T03:21:08.979Z] "id": "Microsoft.Azure.Functions.ExtensionBundle", [2024-03-26T03:21:08.979Z] "version": "[4.*, 5.0.0)" [2024-03-26T03:21:08.979Z] } [2024-03-26T03:21:08.979Z] } [2024-03-26T03:21:09.019Z] FUNCTIONS_WORKER_RUNTIME set to python. Skipping WorkerConfig for language: powershell [2024-03-26T03:21:09.019Z] FUNCTIONS_WORKER_RUNTIME set to python. Skipping WorkerConfig for language: node [2024-03-26T03:21:09.067Z] FUNCTIONS_WORKER_RUNTIME set to python. Skipping WorkerConfig for language: java [2024-03-26T03:21:09.068Z] Looking for extension bundle Microsoft.Azure.Functions.ExtensionBundle at /home/linuxadmin/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle [2024-03-26T03:21:09.069Z] Found a matching extension bundle at /home/linuxadmin/.azure-functions-core-tools/Functions/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/4.13.2 [2024-03-26T03:21:09.093Z] Loading functions metadata [2024-03-26T03:21:09.097Z] Worker indexing is enabled [2024-03-26T03:21:09.108Z] Fetching metadata for workerRuntime: python [2024-03-26T03:21:09.109Z] Reading functions metadata (Worker) [2024-03-26T03:21:09.454Z] Language Worker Process exited. Pid=26321. [2024-03-26T03:21:09.454Z] python3 exited with code 1 (0x1). log.reraise_exception("{0}() failed:", func.name, level="info"), raise RuntimeError(str(endpoints["error"])),RuntimeError: Can't listen for client connections: [Errno 98] Address already in use. [2024-03-26T03:22:09.183Z] Starting worker process failed [2024-03-26T03:22:09.185Z] Microsoft.Azure.WebJobs.Script.Grpc: The operation has timed out. [2024-03-26T03:22:09.197Z] Failed to start language worker process for runtime: (null). workerId:eb0a9825-c9ea-432c-8e98-4c6c0dfe95b9

YunchuWang commented 2 months ago

RuntimeError(str(endpoints["error"])),RuntimeError: Can't listen for client connections: [Errno 98] Address already in use. the port seems already in use, can you try another port?