【发布时间】:2017-10-16 18:33:31
【问题描述】:
您好,我正在尝试在本地调试和开发一个简单的 JavaScript timerTrigger 函数 azure 应用程序,但我遇到了问题。我正在尝试遵循本教程:https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local
调查资料请提供以下信息:
- 时间戳:
- 功能应用名称:testcenter123
- 函数名称(视情况而定):noderepo
- 调用 ID:
- 地区:
我通过 Git 存储库处理了该应用程序,因此它也在我的本地计算机上。
提供重现问题所需的步骤:
-
转到函数应用的根级别并运行(通过 powershell):
func host start --debug vscodeλ func host start --debug vscode %%%%%% %%%%%% @ %%%%%% @ @@ %%%%%% @@ @@@ %%%%%%%%%%% @@@ @@ %%%%%%%%%% @@ @@ %%%% @@ @@ %%% @@ @@ %% @@ %% %[10/16/2017 6:54:48 PM] Host has been specialized Listening on http://localhost:7071/ Hit CTRL-C to exit... [10/16/2017 6:54:48 PM] Reading host configuration file 'C:\Users\xxxxxxxx\code\test-repos\NodeRepo1\host.json' [10/16/2017 6:54:48 PM] Host configuration file read: [10/16/2017 6:54:48 PM] { } [10/16/2017 6:54:48 PM] Loaded custom extension 'BotFrameworkConfiguration' [10/16/2017 6:54:48 PM] Loaded custom extension 'SendGridConfiguration' [10/16/2017 6:54:48 PM] Loaded custom extension 'EventGridExtensionConfig' [10/16/2017 6:54:48 PM] Generating 0 job function(s) [10/16/2017 6:54:48 PM] Starting Host (HostId=laptop2062-1189224982, Version=1.0.11232.0, ProcessId=8180, Debug=False, Attempt=0) [10/16/2017 6:54:48 PM] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.). [10/16/2017 6:54:48 PM] Job host started [10/16/2017 6:54:48 PM] Executing HTTP request: { [10/16/2017 6:54:48 PM] "requestId": "b2d45bf0-1947-4ad7-a9cd-cdfa469d04d2", [10/16/2017 6:54:48 PM] "method": "GET", [10/16/2017 6:54:48 PM] "uri": "/" [10/16/2017 6:54:48 PM] } [10/16/2017 6:54:48 PM] Executed HTTP request: { [10/16/2017 6:54:48 PM] "requestId": "b2d45bf0-1947-4ad7-a9cd-cdfa469d04d2", [10/16/2017 6:54:48 PM] "method": "GET", [10/16/2017 6:54:48 PM] "uri": "/", [10/16/2017 6:54:48 PM] "authorizationLevel": "Anonymous" [10/16/2017 6:54:48 PM] } [10/16/2017 6:54:48 PM] Response details: { [10/16/2017 6:54:48 PM] "requestId": "b2d45bf0-1947-4ad7-a9cd-cdfa469d04d2", [10/16/2017 6:54:48 PM] "status": "OK" [10/16/2017 6:54:48 PM] } launch.json for VSCode configured. Debugger listening on [::]:5858 [10/16/2017 6:54:51 PM] Executing HTTP request: { [10/16/2017 6:54:51 PM] "requestId": "9fe12a9e-446a-4c8e-90db-d0004ac42e31", [10/16/2017 6:54:51 PM] "method": "GET", [10/16/2017 6:54:51 PM] "uri": "/admin/functions/noderepo" [10/16/2017 6:54:51 PM] } [10/16/2017 6:54:51 PM] Executed HTTP request: { [10/16/2017 6:54:51 PM] "requestId": "9fe12a9e-446a-4c8e-90db-d0004ac42e31", [10/16/2017 6:54:51 PM] "method": "GET", [10/16/2017 6:54:51 PM] "uri": "/admin/functions/noderepo", [10/16/2017 6:54:51 PM] "authorizationLevel": "Anonymous" [10/16/2017 6:54:51 PM] } [10/16/2017 6:54:51 PM] Response details: { [10/16/2017 6:54:51 PM] "requestId": "9fe12a9e-446a-4c8e-90db-d0004ac42e31", [10/16/2017 6:54:51 PM] "status": "MethodNotAllowed" [10/16/2017 6:54:51 PM] } 在浏览器中访问
http://localhost:7071/admin/functions/noderepo
查看计时器触发器后,我得到:
<Error>
<Message>
The requested resource does not support http method 'GET'.
</Message>
</Error>
我尝试在 URL 中用 timerTrigger 和 myTrigger 替换 noderepo,但还是一样。我该如何调试?
执行 JavaScript 函数方法并在 VS Code 上中断
其他信息
我的index.js 是这个:
module.exports = function (context, myTimer) {
var timeStamp = new Date().toISOString();
config.UseTimers();
if(myTimer.isPastDue)
{
context.log('JavaScript is running late!');
}
context.log('JavaScript timer trigger function ran!', timeStamp);
context.done();
};
很简单....
【问题讨论】:
-
你是从哪里复制粘贴的?
-
@War10ck 我从 GitHub 的问题页面发布了这个,我也发布了这个:github.com/Azure/azure-webjobs-sdk-script/issues/2037
标签: javascript node.js azure azure-functions