run timer triggered azure function locally on MAC (inside docker)

2.2k views Asked by At

I am trying to run a timer triggered nodejs azure function locally on MAC (inside docker) but getting the following error:

The listener for function 'Functions.MyTimerFunction' was unable to start. Microsoft.WindowsAzure.Storage: Connection refused. System.Net.Http: Connection refused. System.Private.CoreLib: Connection refused.

And when I am trying to trigger the function using HTTP post I get the following error:

System.Private.CoreLib: Exception while executing function: Functions.DomainVerifier. Microsoft.Azure.WebJobs.Host: Exception binding parameter 'myTimer'. Microsoft.WindowsAzure.Storage: Connection refused. System.Net.Http: Connection refused. System.Private.CoreLib: Connection refused.

this is in my local.settings.json file:

"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"AzureWebJobsSecretStorageType": "files",

Any help is appreciated.

2

There are 2 answers

4
George Chen On BEST ANSWER

I can reproduce this error, I test with local windows pc. You get this error when you use UseDevelopmentStorage=true and Storage Emulator is not start.

So set the AzureWebJobsStorage with your storage connection or start Storage Emulator on your local environment. After start the Storage Emulator it will work .

enter image description here

0
James Campbell On

This is a workaround if you are using Mac and don't want to do extra setup/install extra software.

I was able to fix this issue for local development by setting the AzureWebJobsStorage in the local.settings.json to an already existing AzureWebJobsStorage Endpoint of an Azure function I had. You can find this value in the "Configuration" tab of an existing Azure function.

Or, just go ahead and publish the Azure function to Azure. It should create a AzureWebJobsStorage for you, and use this endpoint found in the configuration in Azure.