Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

huangapple go评论63阅读模式
英文:

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

问题

我在将函数部署到Azure函数云后,出现错误:“函数 'Functions.functionname' 的监听器无法启动。” 请帮助解决此问题。

提前致谢

Anish

在本地环境中没有出现此问题。而且早期创建的其他函数也没有出现此问题。

英文:

I am getting error "The listener for function 'Functions.functionname' was unable to start." for ServiceBus trigger function after deploying in azure functions cloud. Please help to resolve this.

Thanks in advance

Anish

This issue is not getting in local environment. And this issue not getting for other functions created earlier.

答案1

得分: 0

重试启动函数'Functions.cancelOrder'的侦听器
(尝试 383) 2023-06-05T02:16:11Z [错误] 函数'Functions.cancelOrder'的侦听器无法启动

这是一个常见错误,当您的本地函数未连接到 Azure 存储帐户,或者如果您正在进行本地开发并且不想使用 Azure 存储帐户,则需要在后台运行 Azure 存储仿真器。另外,如果您未连接到正确的服务总线命名空间。

我尝试创建一个示例的 Azure 服务总线函数应用,并且它成功创建了。

1) 使用 Azure 存储帐户和服务总线连接字符串:

我创建了一个服务总线命名空间和一个队列如下所示:

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

创建了一个 Azure 存储帐户:

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

按照以下步骤创建 Azure Functions 服务总线队列触发器:

从 VS Code Azure Function 扩展中选择创建函数:

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

选择 JavaScript 作为语言:

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

选择模型 v3:

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Azure 服务总线队列触发器:

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

创建本地设置以连接到服务总线:

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

选择服务总线命名空间如下所示:

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

输入我之前在我的服务总线中创建的队列名称,以便我的函数连接到它:

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Azure 服务总线函数在本地创建如下所示:

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

现在,当我通过单击 fn + f5Run > Start Debugging 运行此函数时,它会提示我要么连接到 Azure 存储帐户,要么使用本地存储仿真器:

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

暂时我将点击连接存储帐户,并选择我的 Azure 存储帐户如下所示:

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

由于我在 VS Code 中安装了 Azure Function Core 工具和 Azure Function 扩展,该函数成功运行,如下所示:

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

现在,我将消息发送到 Azure 服务总线队列,函数将被触发:

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

我的 local.settings.json:

{

"IsEncrypted": false,

"Values": {

 "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=azurestrgaccount;AccountKey=xxxxxxxxOxS+ASt1bDRzw==;EndpointSuffix=core.windows.net",

 "FUNCTIONS_WORKER_RUNTIME": "node",

 "siliconfunc12_SERVICEBUS": "Endpoint=sb://siliconfunc12.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=xxxxx5yHisbsUxxxxx"

 }

}

我将以上函数部署到 Azure Function 应用程序,部署成功,如下所示:

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

函数成功部署,如下所示:

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

2) 使用本地存储仿真器:

您可以从此链接在本地计算机上下载存储仿真器。

我按照以上相同的步骤操作,只是在运行函数时,我在从上面链接下载的本地仿真器启动后使用了本地仿真器:

如下图所示打开仿真器:

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

仿真器已启动:

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

现在,我选择了本地仿真器,函数成功触发,如下所示:

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

我的 local.settings.json:

{

"IsEncrypted": false,

"Values": {

 "AzureWebJobsStorage": "UseDevelopmentStorage=true",

 "FUNCTIONS_WORKER_RUNTIME": "node",

 "siliconfunc12_SERVICEBUS": "Endpoint=sb://siliconfunc12.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=xxxxxHisbsUxp47+ASbMxxxx"

 }

}

我尝试将此函数部署到 Azure Function 应用程序,也成功了:

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

如果错误仍然存在,请确保您删除了此路径中的现有 Azure Functions Core 工具 - C\Program Files\Microsoft\Azure Functions Core Tools,并通过参考此链接安装 Azure Function 核心工具的新版本。

我的 Azure Functions Core 工具版本:

func -v
4.0.5148

![输入图像描述](https://i

英文:

> Retrying to start listener for function 'Functions.cancelOrder'
> (Attempt 383) 2023-06-05T02:16:11Z [Error] The listener for function'Functions.cancelOrder' was unable to start

This is a common error that occurs when your Local Function is not connected to either Azure Storage account or if you are doing a local development and do not want to use Azure storage account you need to have Azure storage emulator running in the background. Also, if you're not connected to correct Service bus namespace.

I tried creating one sample Azure Service bus Function app and it was created successfully.

1) With Azure Storage Account and Service bus connection string:-

I created one Service Bus namespace and one queue like below:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Created one Azure Storage account:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Followed the steps below to create Azure Functions Service bus queue trigger:-

Selected create Function from VS code Azure Function extension:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Selected Javascript as language:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Model v3:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Azure Service Bus Queue Trigger:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Created local settings to connect to Service bus:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Selected Service Bus Namespace like below:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Entered the queue name I created earlier in my service bus for my function to connect to it:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

The Azure Service Bus Function is created Locally like below:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Now, When I run this Function by either clicking on fn + f5 or Run > Start Debugging It will prompt me to either connect to Azure storage account or use Local storage emulator:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

For now I will click on Connect Storage account and select my Azure storage account like below:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

As, I have Azure Function Core tools and Azure Function extension installed in VS code, The Function ran successfully, Refer below:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Now, I sent messages to Azure Service Bus queue and the Function was triggered:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

My local.settings.json:-

{

"IsEncrypted": false,

"Values": {

 "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=azurestrgaccount;AccountKey=xxxxxxxxOxS+ASt1bDRzw==;EndpointSuffix=core.windows.net",

 "FUNCTIONS_WORKER_RUNTIME": "node",

 "siliconfunc12_SERVICEBUS": "Endpoint=sb://siliconfunc12.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=xxxxx5yHisbsUxxxxx"

 }

}

I deployed the above Function in Azure Function app and the deployment was successful, Refer below:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Function got deployed successfully, Refer below:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

2) By using Local storage emulator:-

You can download the Storage Emulator in your local machine from this Link.

I followed the same steps as above just while running the function I used Local Emulator after starting the Local Emulator downloaded from the link above:-

Opened Emulator like below:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Emulator started:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Now, I selected Local Emulator and the Function was triggered successfully, Refer below:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

My local.settings.json:-

{

"IsEncrypted": false,

"Values": {

 "AzureWebJobsStorage": "UseDevelopmentStorage=true",

 "FUNCTIONS_WORKER_RUNTIME": "node",

 "siliconfunc12_SERVICEBUS": "Endpoint=sb://siliconfunc12.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=xxxxxHisbsUxp47+ASbMxxxx"

 }

}

I tried deploying this Function in Azure Function app and it was successful too:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

If the error persists, Make sure you delete the existing Azure Functions Core tools from this path - C\Program Files\Microsoft\Azure Functions Core Tools. and install the newer version of Azure Function core tools by referring this Link.

My Azure Functions Core tools version:-

func -v
4.0.5148

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Node.js version:-

node -v
v18.16.0

Storage emulator version:-

5.10.0.0

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Along with this Make sure you have below extensions installed in your VS Code:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

Make sure you also have Azurite extenstion installed:-

Getting error "The listener for function 'Functions.functionname' was unable to start." for Servicebus trigger using node.js

References:-

python - The listener for function 'Functions.trigger' was unable to start? while running Azure function locally - Stack Overflow By venkateshdodda

Listener for Azure function was unable to start error while running Azure function app locally. How to solve this? - Microsoft Q&A By MayankBargali-MSFT

huangapple
  • 本文由 发表于 2023年6月2日 14:33:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/76387672.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定