The listener for function was unable to start. Why?

23,102

Solution 1

For anyone that is encountering this issue the following may help...

Azure Durable Functions rely on TableStorage, and the latest version of Azurite (v3) currently doesn't support TableStorage. As such, pull the Azurite repo and switch to the legacy-master (v2) branch and then run npm run start.

Solution 2

I just witnessed this. This link https://github.com/Azure/azure-functions-core-tools/issues/357 indicates Local Storage Emulator may not be running. I stopped debugging. Went to the Cloud Explorer and opened the local nodes to see blob content. This must have started the Local storage emulator. When I hit run again, Azure Functions Tools started up.

Solution 3

if you are running via storage emulator locally then run func settings add AzureWebJobsStorage UseDevelopmentStorage=true in local.settings.json

and if with a normal Azure Storage connection string using func, must set the AzureWebJobsStorage in local.settings.json

for more view

Solution 4

I solved the issue doing the following steps: Open up a new terminal and type "azurite". The program will open and keep the window opened. Open visual studio and try to run the function again. Voi la.

Solution 5

For me this error was showing up because I didn't have Storage Emulator installed and running. You can install Storage emulator as VS Code plugin from following link. After installing go to VS Code command palette and run Azurite: Start Blob Service. Then run your function locally. It will work fine.

https://marketplace.visualstudio.com/items?itemName=Azurite.azurite

Share:
23,102
vivek nuna
Author by

vivek nuna

Technical Lead at NEC

Updated on July 09, 2022

Comments

  • vivek nuna
    vivek nuna almost 2 years

    I'm getting the following error when I run the azure function from visual studio.

    A ScriptHost error has occurred [1/19/2018 6:40:52 AM] The listener for function 'MyFunctionName' was unable to start. Microsoft.WindowsAzure.Storage: Server encountered an internal error. Please try again after some time.

    When I run from the command prompt by running func host start command. I get the following warning. and then it gets stuck on

    Host lock lease acquired by instance ID

    .

    No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).

    Azure function version: [email protected] I'm using Storage Accounts Blob containers and queues.

    I'm connecting to Development Storage account, I have checked it that storage emulator is started.

    {
      "IsEncrypted": false,
      "Values": {
        "ConnectionStrings:Default": "Server=.\\SQLEXPRESS; Database=TestDb; Trusted_Connection=True;",
        "ConnectionStrings:BlobStorageAccount": "UseDevelopmentStorage=true",
    
        "AzureWebJobsStorage": "UseDevelopmentStorage=true",
        "AzureWebJobsDashboard": "UseDevelopmentStorage=true",
      }
    }
    

    FYI.

    It was working fine before, But I have got this message in Visual Studio.

    your license has gone stale and must be updated. Check for an updated license to continue using this product

    So I just deleted the %localappdata% and %temp%, then I tried to run Azure function and after this, I have started getting

    The listener for function was unable to start error

    So is it related to my visual studio subscription or I mistakenly deleted any required file? Or is this related to something else?

  • Mike Cole
    Mike Cole over 4 years
    The filename must be local.settings.json. Setting needs to be plural.
  • Max Ivanov
    Max Ivanov over 3 years
    Azurite is the way to run Storage Emulator on Mac and Linux. Alternatives to the VS Code plugin are running via a Docker container and installing the Azurite npm package: github.com/azure/azurite
  • Viacheslav Yankov
    Viacheslav Yankov over 3 years
    That was a reason of my problem. Thanks!
  • Stephan
    Stephan over 3 years
    To keep track of v3 support for TableStorage, see this issue: github.com/Azure/Azurite/issues/614. You may install the alpha version npm install -g azurite@alpha (not tested, though).
  • Marcel Gelijk
    Marcel Gelijk about 3 years
    The timer in azure-webjobs-hosts was corrupt. It was fixed after deleting the entry.
  • BorisD
    BorisD about 2 years
    Executing durable functions was working great (uses Azurite) but "regular functions" could not start (Like it was trying to reach the Azure Storage Emulator instead of Azurite) The solution changin "AzureWebJobsStorage" in local.settings.json to the real local connection string AccountName=devstoreaccount1;AccountKey=*****;DefaultEndpoin‌​tsProtocol=http;Blob‌​Endpoint=http://127.‌​0.0.1:10000/devstore‌​account1;QueueEndpoi‌​nt=http://127.0.0.1:‌​10001/devstoreaccoun‌​t1;TableEndpoint=htt‌​p://127.0.0.1:10002/‌​devstoreaccount1; That forces using Azurite in any case.
  • zameb
    zameb about 2 years
    Interesting. Visual Studio was always an integrated development IDE. If "Azurite" is needed, is it an integrated environment yet?
  • delta2_
    delta2_ almost 2 years
    Interesting question. After running the function for a few times there is no need to run azurite from outside visual studio. Don´t ask me why, it´s just a weird behaviour from VS.