Actions on google 从firebase函数获取部分api数据-google上的操作

Actions on google 从firebase函数获取部分api数据-google上的操作,actions-on-google,Actions On Google,当我试图从firebase函数上托管的webhook访问google操作的外部API时,我只返回了部分内容。它停止获取api提供的全部数据。 例如,我尝试使用以下代码从WikipediaAPI获取数据 var request = require('request');//required module //inside the function request({ method: 'GET',url:'https://en.wikipedia.org/w/api.php?action=query

当我试图从firebase函数上托管的webhook访问google操作的外部API时,我只返回了部分内容。它停止获取api提供的全部数据。 例如,我尝试使用以下代码从WikipediaAPI获取数据

var request = require('request');//required module
//inside the function
request({ method: 'GET',url:'https://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&explaintext=&exsectionformat=plain&redirects=&titles=11_September'},function (error, response, body)
        {
            if (!error && response.statusCode == 200) 
            {
                console.log(body);  
            }

        });
app.ask('data obtained');
谁能帮我解决这个问题。
我有一个现收现付的firebase帐户,允许数据流出。

仅从代码片段来看,问题是您在
请求()
的回调之外回复用户。这意味着它会被立即处理,并且功能可能会在接收到整个身体之前结束。尝试类似的方法(我也将
ask()
更改为
tell()
,因为这里没有提示您进行其他响应,您不应该让麦克风保持打开状态。)


谢谢你的回复。但我两者都试过了。由于节点是异步的,所以结果是相同的。那么,您可能希望在问题中包含更多的代码。奇怪。。。我的“维基百科好友”行为或多或少使用了“相同”的代码。您可以在以下位置看到代码:如果您想再次检查它是否为firebase-请从另一台NodeJS服务器上尝试您的代码。我一定会尝试,然后会回来
var request = require('request');//required module
//inside the function
request({ method: 'GET',url:'https://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&explaintext=&exsectionformat=plain&redirects=&titles=11_September'},function (error, response, body)
        {
            if (!error && response.statusCode == 200) 
            {
                console.log(body);  
                app.tell('data obtained');
            }

        });