Azure函数应用程序没有给出任何类型的输出并最终给出错误

问题描述:

当我尝试运行基于NodeJs的Azure函数时,遇到了一个问题,它没有产生任何反馈,在某些情况下,我最终得到以下消息:Azure函数应用程序没有给出任何类型的输出并最终给出错误

2017-04-05T00:18:15.969 Exception while executing function: Functions.AddAuthor. Microsoft.Azure.WebJobs.Script: Thread was being aborted. 

我所有的功能代码是公开的,你可以看到它here。它使用的库在本地工作。对于为什么它不想在Azure函数中工作,我有点不知所措。

我最初在Azure Functions github repo上发布了这个,但有人建议我可能在这里问。

此外,它似乎甚至是一个简单的context.logwon't even work

+0

你的函数代码调用anecdoteService.close()。 anecdoteService在哪里宣布? –

+0

它是这个图书馆的所有部分,在这里找到'close':https://github.com/atrauzzi/anecdote-engine/blob/master/src/Engine/Service.ts#L50 - 虽然这个图书馆故意不'里面没有任何特定的功能。 –

+0

对不起,我对库不熟悉,所以anecdote.service与anecdocteService不同吗? –

有一两件事我注意到 - context并不在此范围存在:https://github.com/atrauzzi/anecdote-azure/blob/master/functions/index.js#L13

如果我成立了一个类似的功能,我看到:

2017-04-12T17:06:55.433 Exception while executing function: Functions.ManualJS. mscorlib: ReferenceError: context is not defined at Object. (D:\home\site\wwwroot\ManualJS\test.js:1:63)

而且,“anecdoteService”未在此范围内定义。

anecdote.service 
    .addAuthor(author) 
    .then(function() { anecdoteService.close()}) 
    .then(function() { context.log("End of line")}) 

该功能是否与azure-functions-cli一起使用?

看着你提供的要点,你提供了一个函数吗?

// index.js 
module.exports = function(context) { 
    context.log('hello'); 
    //there needs to be a context.done or your function will not finish 
} 

或者是它只是

// index.js 
context.log('hello'); // there's no context object, no function, etc 
+0

我知道这听起来很奇怪,但我没有使用Azure函数CLI。部分是因为我没有设置它,但也部分是因为我真的希望他们发布一个独立于平台的版本。我不介意专有,但平*立是必须的。我认为这个更大的问题是,我没有从函数门户获得任何可操作的反馈。 –

+0

正如我上面提到的,一个问题是,即使我删除了所有的代码并用'context.log(“hello?!”)'替换它,我仍然没有输出。这就像整个事情已经死了。 –

+0

不知道要做什么的要点,编辑我的答案上面的代码格式。 –