问题描述
我已经部署了一个 TimerTrigger 类型的 Azure Function App,平台设置为 Windows,应用服务计划到消费计划,运行时为 Node.JS。当我使用 VS Code 进行部署时,它运行良好。但是当我在 Azure Repos 上为 CI/CD 设置 Azure Pipeline 以将代码直接部署到函数应用程序时,该函数开始抛出以下错误:
Full Exception :
Microsoft.Azure.WebJobs.Host.FunctionTimeoutException : Timeout value of 00:05:00 was exceeded by function: Functions.rally-confluence-function
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryHandleTimeoutAsync(Task invokeTask,CancellationToken shutdownToken,Boolean throwOnTimeout,CancellationToken timeoutToken,TimeSpan timeoutInterval,IFunctionInstance instance,Action onTimeout) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs : 633
at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.InvokeWithTimeoutAsync(IFunctionInvoker invoker,ParameterHelper parameterHelper,CancellationTokenSource timeoutTokenSource,CancellationTokenSource functionCancellationTokenSource,TimeSpan timerInterval,IFunctionInstance instance) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs : 549
at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstanceEx instance,ILogger logger,CancellationTokenSource functionCancellationTokenSource) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs : 505
at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance,FunctionStartedMessage message,FunctionInstanceLogEntry instanceLogEntry,CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs : 283
at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance,CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs : 330
at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsync(IFunctionInstance functionInstance,CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs : 94
从那以后,我一直无法找出问题所在。我再次尝试从 VS Code 部署该功能,但仍然是同样的问题。
host.json
{
"version": "2.0","extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle","version": "[1.*,2.0.0)"
}
}
应用设置:
[
{
"name": "FUNCTIONS_EXTENSION_VERSION","value": "~3","slotSetting": false
},{
"name": "FUNCTIONS_WORKER_RUNTIME","value": "node",{
"name": "WEBSITE_RUN_FROM_PACKAGE","value": "1","slotSetting": false
}
]
这个问题已经挂了很长时间,所以感谢任何帮助。
提前致谢
解决方法
由于最初从 VS 代码部署时该函数运行良好,因此我认为您的函数没有任何问题。
您可以配置函数应用的超时时间。在函数应用的 host.json 中将 functionTimeout
字段的值从 "00:05:00"
更改为 "00:10:00"
。