0

I am developing a Google Action with Dialogflow fulfillment and have a strange error. At some point the answer is not correctly parsed into an AppResponse although it is correctly formed.

The only different seems to be the size. I measured the size and found out that when the JSON response from by backend exceeds 1021 characters (one character more in the text is enough), it gives me this error:

Failed to parse Dialogflow response into AppResponse because of empty speech response

It is reproducable to only add one additional character in the response text and it let's the response fail.

I cannot find any size limitation regarding the JSON response. All limitations in the response text & card are sufficient for my example.

{
"payload": {
    "google": {
        "expectUserResponse": true,
        "richResponse": {
            "items": [
                {
                    "simpleResponse": {
                        "textToSpeech": "328 characters here"
                    }
                },
                {
                    "basicCard": {
                        "title": "39 characters",
                        "subtitle": "16 characters",
                        "formattedText": "82 characters here"
                    }
                }
            ],
            "suggestions": [
                {
                    "title": "13 characters"
                },
                {
                    "title": "14 characters"
                },
                {
                    "title": "6 characters"
                }
            ]
        }
    }
},
"outputContexts": [
    {
        "name": "default",
        "lifespanCount": 99,
        "parameters": {
            "data": "54 characters"
        }
    }
]
}
tkupek
  • 37
  • 7

1 Answers1

0

The problem was actually related to the NodeJS Express server compression, combined with the AWS API Gateway. After a certain treshold, the Express server activates the GZIP content-encoding, that the AWS API Gateway does not understand. Disabling the compression solved the issue.

tkupek
  • 37
  • 7