Reputation: 43
Receiving the following error on my Google Diaglogflow intent from the intent below. The console.log("res", res)
is correctly logging the JSON, but 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?
is logged immediately before it.
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");
});
});
Upvotes: 0
Views: 519
Reputation: 11970
If you're doing an asynchronous callback, you need to return
the Promise object.
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");
});
});
Upvotes: 2