Error "Empty speech response"
Asked Answered
P

6

6

I tried to connect DialogFlow and Actions on Google, so I created some intents, connected the services, added explicit and implicit invocations etc, but when I try the bot in the simulator https://console.actions.google.com/project/[projectId]/simulator/ it always gives me the error:

"Failed to parse Dialogflow response into AppResponse, exception thrown with message: Empty speech response"

even tough inputType was "KEYBOARD".

What I tried so far:

Unfortunately the docs don't say anything about this error. Any ideas?

Here a screenshot of the error on the Actions integration: enter image description here

This is the full debug output:

{
  "agentToAssistantDebug": {
    "agentToAssistantJson": {
      "message": "Failed to parse Dialogflow response into AppResponse, exception thrown with message: Empty speech response",
      "apiResponse": {
        "id": "c12e1389-e887-49d4-b399-a332188ca946",
        "timestamp": "2018-01-27T03:55:30.931Z",
        "lang": "en-us",
        "result": {},
        "status": {
          "code": 200,
          "errorType": "success"
        },
        "sessionId": "1517025330705"
      }
    }
  },
  "assistantToAgentDebug": {
    "assistantToAgentJson": {
      "user": {
        "userId": "USER_ID",
        "locale": "en-US",
        "lastSeen": "2018-01-27T03:55:03Z"
      },
      "conversation": {
        "conversationId": "1517025330705",
        "type": "NEW"
      },
      "inputs": [
        {
          "intent": "actions.intent.MAIN",
          "rawInputs": [
            {
              "inputType": "KEYBOARD",
              "query": "Talk to Mica, the Hipster Cat Bot"
            }
          ]
        }
      ],
      "surface": {
        "capabilities": [
          {
            "name": "actions.capability.MEDIA_RESPONSE_AUDIO"
          },
          {
            "name": "actions.capability.WEB_BROWSER"
          },
          {
            "name": "actions.capability.AUDIO_OUTPUT"
          },
          {
            "name": "actions.capability.SCREEN_OUTPUT"
          }
        ]
      },
      "isInSandbox": true,
      "availableSurfaces": [
        {
          "capabilities": [
            {
              "name": "actions.capability.AUDIO_OUTPUT"
            },
            {
              "name": "actions.capability.SCREEN_OUTPUT"
            }
          ]
        }
      ]
    },
    "curlCommand": "curl -v 'https://api.api.ai/api/integrations/google?token=TOKEN' -H 'Content-Type: application/json;charset=UTF-8' -H 'Google-Actions-API-Version: 2' -H 'Authorization: AUTH_TOKEN'  -A 'Mozilla/5.0 (compatible; Google-Cloud-Functions/2.1; +http://www.google.com/bot.html)' -X POST -d '{\"user\":{\"userId\":\"USER_ID\",\"locale\":\"en-US\",\"lastSeen\":\"2018-01-27T03:55:03Z\"},\"conversation\":{\"conversationId\":\"1517025330705\",\"type\":\"NEW\"},\"inputs\":[{\"intent\":\"actions.intent.MAIN\",\"rawInputs\":[{\"inputType\":\"KEYBOARD\",\"query\":\"Talk to Mica, the Hipster Cat Bot\"}]}],\"surface\":{\"capabilities\":[{\"name\":\"actions.capability.MEDIA_RESPONSE_AUDIO\"},{\"name\":\"actions.capability.WEB_BROWSER\"},{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"}]},\"isInSandbox\":true,\"availableSurfaces\":[{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"}]}]}'"
  },
  "sharedDebugInfo": [
    {
      "name": "ResponseValidation",
      "subDebugEntry": [
        {
          "debugInfo": "API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: \": Cannot find field.\".",
          "name": "UnparseableJsonResponse"
        }
      ]
    }
  ]
}

Also "debugInfo" sounds like an internal problem:

"API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: \": Cannot find field.\"."

Here a screenshot of the welcome intent: enter image description here

ps. It took me AGES to figure out, what

"Query pattern is missing for custom intent"

means - so I just document it here: In Dialog Flow - Intent - "User says" you have to DOUBLE CLICK on a word in the text input field when you want to set it as query parameter - which seems to be required for Actions on Google.

Phosphorous answered 27/1, 2018 at 4:28 Comment(6)
Can you update your question to include a screen shot of the welcome Intent? Do you have the fulfillment checkbox checked for the Intent? If so, can you also update the question to include the JSON that you are returning from the webhook and what Dialogflow version you're using?Rhodes
As the one who posted as per your link, I had a different error message ('Cannot find field') than you - see also #48158917 And this was thanks to @Rhodes who is kind enough to add a comment above.Pancreatin
I've seen this error when a failure happens on my webhook and I never get to return any text, or there's some other text issue.Mcnamee
@prisoner I updated my question (screenshots and what I tried). The problem also occurs when I disable the Fulfillment webhook. I also tried v1 and v2,Phosphorous
Ok, good. Can you also include a screenshot that includes having the "Response -> Default" tab selected? When you had the fulfillment webhook configured, what was the JSON you were sending back?Rhodes
@Rhodes in the "Response -> Default" secion I just have some texts - the default texts from Dialog Flow itself. As I said before, the webhook is working within Dialog Flow itself. imgur.com/a/Ri3zu In V1 I respond with JSON {"speech":"blabla", "displayText":"blabla"} which works fine in Dialog Flow e.g. in the Web Demo bot.dialogflow.com/994dda8b-4849-4a8a-ab24-c0cd03b5f420Phosphorous
P
-5

The Actions on Google support helped me fix this problem:

I needed to add a text as Default Response to the intent used for Explicit Invocation.

Phosphorous answered 30/1, 2018 at 14:14 Comment(3)
what did that look like?Colicweed
Yes. That got rid of the error. But it always gives the default response and not the custom msg from my index.jsJackstraws
please add the full response to your question where did you add it and what was the field name that you addedVocal
C
9

This happened to me. If this happens for an Intent you just added in the Dialogflow console and you are using Webhook fulfillment for the action, check the intent's fulfillment settings and ensure that the Webhook fulfillment slider is on. Evidently new intents don't automatically get webhook fulfillment: you have to opt each one in piecemeal (or at least, that was my experience).

Consumedly answered 20/8, 2018 at 20:49 Comment(1)
I did that, however, I am still getting "empty response". This is inspite of the fact that from my webhook server running on my machine, it shows a 200 status.Chauchaucer
T
2

I experienced this situation too. My problem was that I used a SimpleResponse in my fulfillment index.js without referencing to it. So the solution for me was to add SimpleResponse like this in index.js:

const {dialogflow, SimpleResponse} = require('actions-on-google');

So, always check if you aren't using any dependencies without including it in your js-file. Probably not the most common cause of the problem, but it can be.

Tightrope answered 4/3, 2019 at 13:51 Comment(0)
B
1

I got this when running through the codelabs tutorial (https://codelabs.developers.google.com/codelabs/actions-1/index.html#4) and didn't name my intent the same name as it is referenced in the webhook script: Name Intent Use Intent

Bonnee answered 15/2, 2019 at 19:43 Comment(0)
H
0

I came across this error when trying to develop my own WebHook. I first verified that my code was called by looking into the Nginx log, after which I knew there was a problem in my JSON output because I based my output on outdated examples.

The (up-to-date) documentation for both V1 and V2 of the API can be found here: https://dialogflow.com/docs/fulfillment/how-it-works

This example response for v2 of the dialogflow webhook API helped me to resolve this error:

{
  "payload": {
    "google": {
      "expectUserResponse": true,
      "richResponse": {
        "items": [
          {
            "simpleResponse": {
              "textToSpeech": "this is a simple response"
            }
          }
        ]
      }
    }
  }
}

Source: https://github.com/dialogflow/fulfillment-webhook-json/blob/master/responses/v2/ActionsOnGoogle/RichResponses/SimpleResponse.json

You can find more examples in the official github repository linked above.

Hamster answered 18/1, 2019 at 15:13 Comment(0)
B
0

Another possibility is if you have a text response (even an empty one) like so: Responses Box

Then you need to click the trash can next to the response to clear it out to use the webhook.

Bonnee answered 20/2, 2019 at 16:47 Comment(0)
P
-5

The Actions on Google support helped me fix this problem:

I needed to add a text as Default Response to the intent used for Explicit Invocation.

Phosphorous answered 30/1, 2018 at 14:14 Comment(3)
what did that look like?Colicweed
Yes. That got rid of the error. But it always gives the default response and not the custom msg from my index.jsJackstraws
please add the full response to your question where did you add it and what was the field name that you addedVocal

© 2022 - 2024 — McMap. All rights reserved.