I'm working on an app for Google Home with DialogFlowV2 but I've got a problem.
I'm using Google Cloud Functions, I've defined 3 functions, welcome, fallback and getTVShow.
The third one is the interesting one, i'm getting data from an API and send it with the add method of webhookClient.
I got this error when I call it :
Error: No responses defined for undefined
at V2Agent.sendResponse_ (/user_code/node_modules/dialogflow-fulfillment/v2-agent.js:140:13)
at WebhookClient.send_ (/user_code/node_modules/dialogflow-fulfillment/dialogflow-fulfillment.js:225:19)
at promise.then (/user_code/node_modules/dialogflow-fulfillment/dialogflow-fulfillment.js:285:38)
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
I've looked into the source code and this is corresponding to the request source which is undefined after getting the data from the source in originalDetectIntentRequest from the request body.
So, i've done a console.log on the request.body.originalDetectIntentRequest and the result is :
{ payload: {} }
Therefore, it's normal to have an error but i don't want it.
Can someone help me, please ?
UPDATE
I’ve find out it only happens when i use the “playground” from DialogFlow. It's the "Try it now" input at https://console.dialogflow.com/ right side. I've post an issue about this on the GitHub repo.
UPDATE 2
It was all about a forgotten return. When using async requests, we need to return the promise.