无法在Azure函数中执行HTTP请求 [英] Not able to do http requests within azure function

查看:59
本文介绍了无法在Azure函数中执行HTTP请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试新的

该功能永无止境.文本内部请求回调永远不会显示,并且 cancel 按钮保持启用状态.

这里有我不知道的一些限制吗?还是我做错了什么?

解决方案

如果存在更改检测错误(或者您怀疑这可能是问题所在),请采取一些解决方法:

  1. 更新正在执行的日志语句.(context.log('功能已触发');).如果那仍然运行旧版本,那么您肯定知道这是问题所在.
  2. 编辑function.json(不仅仅是代码).
  3. 从azure门户重新启动站点.那里有一个停止"按钮.

I'm testing the new Azure Function service.

I've installed the request npm library, but it kind of looks like any requests are being blocked some how.

This is my small function:

var request = require('request');

module.exports = function(context, req) {
    context.log('function triggered');
    request('http://www.db.no/', function(error, response, body) {
       context.log("inside request callback");
       context.done(); 
    });
};

When triggering the function, I get the following logs:

2016-06-23T21:59:36  Welcome, you are now connected to log-streaming service.
2016-06-23T21:59:39.185 Function started (Id=774d5763-d279-4838-9344-e55a0fcbd858)
2016-06-23T21:59:39.716 function triggered

but there it stops.

The function never ends. The text inside request callback never shows up, and the cancel button remains enabled.

Are there some limitations here that I don't know about? Or am I doing something wrong?

解决方案

If there is a change-detection bug (or you're suspicious that may be the issue), some workarounds:

  1. update the log statement that you see is being executed. (context.log('function triggered'); ) . If that still runs the old one, you know for sure this is the problem.
  2. Edit the function.json (not just the code).
  3. Restart the site from the azure portal. There's a "stop" button in there.

这篇关于无法在Azure函数中执行HTTP请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆