pythonazurevisual-studio-codeazure-functionsgrpc

Python Based Azure Function Local Debug in VsCode Fails with grpc.FutureTimeoutError()


I use the Azure extension in VS Code to create an azure function project. Below is a screenshot of my project structure, all files are default valued, created by the vsCode Azure extension wizard.

enter image description here

I start up azurite for a storage emulator and when I try to debug the function locally, I get a grpc.FutureTimeoutError(), see below

enter image description here

When i was troubleshooting, I deployed my code to a function app on my Azure subscription and it worked with no issues (logging messages confirmed everything was running). This issue only occurs when im trying to debug locally in vscode. I've tried creating both v1 and v2 functions projects and i get the same error.

Edit:

Here is my init.py function definition below. When I deploy it to a function app on the cloud it executes and I can see the log messages

enter image description here


Solution

  • I had a similar issue. Azure Function Core Tools func start commands was ending with this error:

    [2024-12-10T11:48:03.419Z]  ERROR: unhandled error in functions worker: 
    [2024-12-10T11:48:03.434Z] Language Worker Process exited. Pid=3981.
    [2024-12-10T11:48:03.434Z] python3 exited with code 1 (0x1). 
    grpc.FutureTimeoutError,    raise 
    grpc.FutureTimeoutError(),grpc.FutureTimeoutError.
    

    To solve the problem, I had to modify the no_proxy variable. It was set in this way: localhost,127.0.0.1,.local and I had to remove the 127.0.0.1.

    As an example, with such value for the no_proxy : localhost,.local, it works properly.

    The network environment has a strong impact here. For information, I'm using WSL2 + docker desktop with settings "Enable host networking" config + devcontainer using host networking mode.

    If I disable the docker desktop settings "Enable host networking", the azure function works tool works even if the no_proxy variable contains the 127.0.0.1

    Removing the 127.0.0.1 can probably lead to other issues as such http requests must clearly not use the proxy