Azure Functions Core Tools 使用默认函数 : can't find . ./azurefunctions/functions.js 引发错误

标签 azure azure-functions azure-functions-core-tools

几周前我重新安装了 Windows 10,并且必须重新安装所有工具。由于不是专业人士,我只是使用了所有内容的最新版本,并且今天更新了核心工具。

我目前在

  • 节点:8.11.1
  • 核心工具:1.0.11

我刚刚创建了一个新的函数应用程序和函数,当我尝试通过 Postman 调用 URI 时收到以下错误。

{
    "id": "53b6098d-69e4-45a1-9f0f-2bec6f965435",
    "requestId": "ca41a391-35ca-440f-a78b-007473b9ee5a",
    "statusCode": 500,
    "errorCode": 0,
    "message": "Exception while executing function: Functions.HttpTriggerJS -> One or more errors occurred. -> Error: Cannot find module '../azurefunctions/functions.js'\n    at Function.Module._resolveFilename (module.js:469:15)\n    at Function.Module._load (module.js:417:25)\n    at Module.require (module.js:497:17)\n    at require (internal/module.js:20:19)\n    at eval (eval at compileFunc (C:\\Users\\giraffeslacks\\AppData\\Roaming\\npm\\node_modules\\azure-functions-core-tools\\bin\\edge\\double_edge.js:34:28), <anonymous>:1:23)\n    at compileFunc (C:\\Users\\giraffeslacks\\AppData\\Roaming\\npm\\node_modules\\azure-functions-core-tools\\bin\\edge\\double_edge.js:35:16)",
    "errorDetails": "Microsoft.Azure.WebJobs.Host.FunctionInvocationException : Exception while executing function: Functions.HttpTriggerJS ---> System.AggregateException : One or more errors occurred. ---> Error: Cannot find module '../azurefunctions/functions.js'\n    at Function.Module._resolveFilename (module.js:469:15)\n    at Function.Module._load (module.js:417:25)\n    at Module.require (module.js:497:17)\n    at require (internal/module.js:20:19)\n    at eval (eval at compileFunc (C:\\Users\\giraffeslacks\\AppData\\Roaming\\npm\\node_modules\\azure-functions-core-tools\\bin\\edge\\double_edge.js:34:28), <anonymous>:1:23)\n    at compileFunc (C:\\Users\\giraffeslacks\\AppData\\Roaming\\npm\\node_modules\\azure-functions-core-tools\\bin\\edge\\double_edge.js:35:16)\r\n   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\r\n   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout,CancellationToken cancellationToken)\r\n   at EdgeJs.Edge.Func(String code)\r\n   at Microsoft.Azure.WebJobs.Script.Description.NodeFunctionInvoker.get_GlobalInitializationFunc()\r\n   at async Microsoft.Azure.WebJobs.Script.Description.NodeFunctionInvoker.InitializeAsync()\r\n   at async Microsoft.Azure.WebJobs.Script.Description.NodeFunctionInvoker.InvokeCore(Object[] parameters,FunctionInvocationContext context)\r\n   at async Microsoft.Azure.WebJobs.Script.Description.FunctionInvokerBase.Invoke(Object[] parameters)\r\n   at async Microsoft.Azure.WebJobs.Host.Executors.VoidTaskMethodInvoker`2.InvokeAsync[TReflected,TReturnType](TReflected instance,Object[] arguments)\r\n   at async Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`2.InvokeAsync[TReflected,TReturnValue](Object instance,Object[] arguments)\r\n   at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.InvokeAsync(IFunctionInvoker invoker,ParameterHelper parameterHelper,CancellationTokenSource timeoutTokenSource,CancellationTokenSource functionCancellationTokenSource,Boolean throwOnTimeout,TimeSpan timerInterval,IFunctionInstance instance)\r\n   at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstance instance,ParameterHelper parameterHelper,TraceWriter traceWriter,CancellationTokenSource functionCancellationTokenSource)\r\n   at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??)\r\n   at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??)\r\n---> (Inner Exception #0) System.Exception : Error: Cannot find module '../azurefunctions/functions.js'\n    at Function.Module._resolveFilename (module.js:469:15)\n    at Function.Module._load (module.js:417:25)\n    at Module.require (module.js:497:17)\n    at require (internal/module.js:20:19)\n    at eval (eval at compileFunc (C:\\Users\\giraffeslacks\\AppData\\Roaming\\npm\\node_modules\\azure-functions-core-tools\\bin\\edge\\double_edge.js:34:28), <anonymous>:1:23)\n    at compileFunc (C:\\Users\\giraffeslacks\\AppData\\Roaming\\npm\\node_modules\\azure-functions-core-tools\\bin\\edge\\double_edge.js:35:16)<---\r\n \r\n   End of inner exception\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??)\r\n   at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsync(IFunctionInstance functionInstance,CancellationToken cancellationToken)\r\n   at Microsoft.Azure.WebJobs.Host.Executors.ExceptionDispatchInfoDelayedException.Throw()\r\n   at async Microsoft.Azure.WebJobs.JobHost.CallAsync(??)\r\n   at async Microsoft.Azure.WebJobs.Script.ScriptHost.CallAsync(String method,Dictionary`2 arguments,CancellationToken cancellationToken)\r\n   at async Microsoft.Azure.WebJobs.Script.WebHost.WebScriptHostManager.HandleRequestAsync(FunctionDescriptor function,HttpRequestMessage request,CancellationToken cancellationToken)\r\n   at async Microsoft.Azure.WebJobs.Script.Host.FunctionRequestInvoker.ProcessRequestAsync(HttpRequestMessage request,CancellationToken cancellationToken,WebScriptHostManager scriptHostManager,WebHookReceiverManager webHookReceiverManager)\r\n   at async Microsoft.Azure.WebJobs.Script.WebHost.Controllers.FunctionsController.<>c__DisplayClass3_0.<ExecuteAsync>b__0(??)\r\n   at async Microsoft.Azure.WebJobs.Extensions.Http.HttpRequestManager.ProcessRequestAsync(HttpRequestMessage request,Func`3 processRequestHandler,CancellationToken cancellationToken)\r\n   at async Microsoft.Azure.WebJobs.Script.WebHost.Controllers.FunctionsController.ExecuteAsync(HttpControllerContext controllerContext,CancellationToken cancellationToken)\r\n   at async System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n   at async System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n   at async Microsoft.Azure.WebJobs.Script.WebHost.Handlers.WebScriptHostHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n   at async Microsoft.Azure.WebJobs.Script.WebHost.Handlers.SystemTraceHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n   at async System.Web.Http.HttpServer.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)"
}

最佳答案

最新的 v1.0.11 功能核心工具似乎存在错误。

我在我这边使用 npm 安装它,并在触发后重现错误 js httptrigger(模板)。

该错误似乎仅在使用 js 触发器时发生,当我创建 js blobtrigger 时也会发生相同的错误。对于c#,在 httptrigger 和 blobtrigger 上测试,两者都有效。

我已经打开an issue在github上并等待Azure团队的回复。

关于Azure Functions Core Tools 使用默认函数 : can't find . ./azurefunctions/functions.js 引发错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50055354/

相关文章:

azure - 如何通过 Azure 上的 ServiceDefinition 中给出的名称获取证书

azure - 将现有托管数据磁盘附加到现有 azure VM

azure - Azure Functions 中的个人 One Drive Microsoft Graph 绑定(bind)

azure-devops - 如何指定 azure-functions-core-tools 的版本?

azure-functions - python azure 函数 v2 msauthentication

azure - 通过 REST API 获取 iothub 注册设备

asynchronous - Blob.UploadAsync 方法上的 StorageClientException

python - 具有多个 Python 文件的 Azure 函数

c# - 使用公共(public)中间证书获取 Azure Function App 到 https(APIM) 端点调用的部分链异常

azure - 为什么 host.json 没有被复制到 F# Azure Functions 项目中的输出?