Issue with APL for the size of datasource document



I am using APL to render a list of items on the screen. When I use a small list (of 5-6 items), the skill works but when the list is as large as 35 items, the skill stops working. Below is response :

"request": {
		"type": "SessionEndedRequest",
		"requestId": "amzn1.echo-api.request.637ae3d0-28f4-42a1-ad2f-8a170db73507",
		"timestamp": "2019-11-29T09:01:00Z",
		"locale": "en-IN",
		"reason": "ERROR",
		"error": {
			"type": "INVALID_RESPONSE",
			"message": "An exception occurred while dispatching the request to the skill."


How large is the response object?

Could you add this middleware function into your app.js

app.hook("after.platform.output", (error, host, jovo) => {
  console.log(`Size of response: ${JSON.stringify(jovo.$response).length}`);

I had the same INVALID_RESPONSE error response with around 24500 chars.


Yes, I tried that and the size of my response is 34304 and this is just the beginning, the size may increase 10-15 times of this in the future.

How do I get rid of this problem?


The total size of your response cannot exceed 24 kilobytes.

Looks like < 24k characters is the limit.

Refactor your APL (shorter names, simple layout, shorter urls, reduce datasource, add pagination etc).