Azure Durable Function HttpStart 失败:未配置 Webhook
Azure Durable Function HttpStart failure: Webhooks are not configured
我已经在 Azure Kubernetes 服务中部署了 Azure Durable Http Triggered Function 应用程序。我使用 Visual Studio 代码来创建函数应用程序。我已按照此 article and Microsoft official documentation.
中的说明进行操作
Function runtime: 3.0.2630
Python version: 3.7.7
azure-functions: 1.3.1
azure-functions-durable: 1.0.0b9
这是我的 HttStart function.json
文件,
{
"scriptFile": "__init__.py",
"bindings": [
{
"authLevel": "anonymous",
"name": "req",
"type": "httpTrigger",
"direction": "in",
"route": "orchestrators/{functionName}",
"methods": [
"post",
"get"
]
},
{
"name": "$return",
"type": "http",
"direction": "out"
},
{
"name": "starter",
"type": "orchestrationClient",
"direction": "in"
}
]
}
Docker 文件:
FROM mcr.microsoft.com/azure-functions/python:3.0-python3.7
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
COPY requirements.txt /
RUN pip install -r /requirements.txt
COPY . /home/site/wwwroot
此应用程序在我的本地环境中运行良好。部署到 AKS 群集后,当我调用 URL 时,它会抛出以下预期
fail: Function.HelloWorldHttpStart[3]
Executed 'Functions.HelloWorldHttpStart' (Failed, Id=e7dd35a1-2001-4f11-396f-d251cbd87a0d, Duration=82ms)
Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: Functions.HelloWorldHttpStart
---> System.InvalidOperationException: Webhooks are not configured
at Microsoft.Azure.WebJobs.Extensions.DurableTask.HttpApiHandler.ThrowIfWebhooksNotConfigured() in d:\a\r1\a\azure-functions-durable-extension\src\WebJobs.Extensions.DurableTask\HttpApiHandler.cs:line 737
有没有我遗漏的配置?如有任何建议,我们将不胜感激。
谢谢。
尝试添加一个 WEBSITE_HOSTNAME
环境变量,并将 <ip-address>:<port>
作为值,其中 <ip-address>:<port>
指的是可用于从外部访问您的函数应用程序的地址。
当您使用依赖于此环境变量的 API 时会发生此错误。当 运行 使用本地核心工具时,此值会自动设置为 localhost:7071
。当 运行 在 Azure Functions 托管服务中时,此环境变量也 pre-configured 成为函数应用程序的 DNS 名称(例如 myfunctionapp.azurewebsites.net
。对于其他环境,如 AKS,您将需要显式添加此环境变量并将其设置为适合您的部署的正确值。
我已经在 Azure Kubernetes 服务中部署了 Azure Durable Http Triggered Function 应用程序。我使用 Visual Studio 代码来创建函数应用程序。我已按照此 article and Microsoft official documentation.
中的说明进行操作Function runtime: 3.0.2630
Python version: 3.7.7
azure-functions: 1.3.1
azure-functions-durable: 1.0.0b9
这是我的 HttStart function.json
文件,
{
"scriptFile": "__init__.py",
"bindings": [
{
"authLevel": "anonymous",
"name": "req",
"type": "httpTrigger",
"direction": "in",
"route": "orchestrators/{functionName}",
"methods": [
"post",
"get"
]
},
{
"name": "$return",
"type": "http",
"direction": "out"
},
{
"name": "starter",
"type": "orchestrationClient",
"direction": "in"
}
]
}
Docker 文件:
FROM mcr.microsoft.com/azure-functions/python:3.0-python3.7
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
COPY requirements.txt /
RUN pip install -r /requirements.txt
COPY . /home/site/wwwroot
此应用程序在我的本地环境中运行良好。部署到 AKS 群集后,当我调用 URL 时,它会抛出以下预期
fail: Function.HelloWorldHttpStart[3]
Executed 'Functions.HelloWorldHttpStart' (Failed, Id=e7dd35a1-2001-4f11-396f-d251cbd87a0d, Duration=82ms)
Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: Functions.HelloWorldHttpStart
---> System.InvalidOperationException: Webhooks are not configured
at Microsoft.Azure.WebJobs.Extensions.DurableTask.HttpApiHandler.ThrowIfWebhooksNotConfigured() in d:\a\r1\a\azure-functions-durable-extension\src\WebJobs.Extensions.DurableTask\HttpApiHandler.cs:line 737
有没有我遗漏的配置?如有任何建议,我们将不胜感激。
谢谢。
尝试添加一个 WEBSITE_HOSTNAME
环境变量,并将 <ip-address>:<port>
作为值,其中 <ip-address>:<port>
指的是可用于从外部访问您的函数应用程序的地址。
当您使用依赖于此环境变量的 API 时会发生此错误。当 运行 使用本地核心工具时,此值会自动设置为 localhost:7071
。当 运行 在 Azure Functions 托管服务中时,此环境变量也 pre-configured 成为函数应用程序的 DNS 名称(例如 myfunctionapp.azurewebsites.net
。对于其他环境,如 AKS,您将需要显式添加此环境变量并将其设置为适合您的部署的正确值。