Google Async上的操作问题:错误:未设置响应

时间:2018-10-22 22:14:59

标签: node.js promise actions-on-google google-home

从下面的意图中收到有关我的Google Diaglogflow意图的以下错误。 console.log("res", res)正确地记录了JSON,但是Error: No response has been set. Is this being used in an async call that was not returned as a promise to the intent handler?被记录在其前。

app.intent(DO_MY_THING, conv => {
  console.log("DO_MY_THING");
  axios
    .get("example.com")
    .then(res => {
      console.log("res", res);
      conv.close("Did the thing");
    })
    .catch(err => {
      console.log("err", err);
      conv.close("didnt do the thing");
    });
});

1 个答案:

答案 0 :(得分:2)

如果要执行异步回调,则需要temp Promise对象。

> u1[i]
[1] 1.361594
> u2[i]
[1] 2.868618
> u3[i]
[1] 5.958975