Actions On Google Async Issue: Error: No response has been set
Actions On Google Async Issue: Error: No response has been set
在我的 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");
});
});
如果您正在执行异步回调,则需要 return
Promise 对象。
app.intent(DO_MY_THING, conv => {
console.log("DO_MY_THING");
return 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");
});
});
在我的 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");
});
});
如果您正在执行异步回调,则需要 return
Promise 对象。
app.intent(DO_MY_THING, conv => {
console.log("DO_MY_THING");
return 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");
});
});